This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function mysqlquery($query,$dbcon,$returnValue = false){ | |
$result = $dbcon->query($query); | |
if(!$result){ | |
die('There was an error running the query [' . $dbcon->error . ']'); | |
} | |
//Do not use `fetch_assoc()` in INSERT query to prevent | |
//`PHP Fatal error: Call to a member function fetch_assoc() on a non-object` error. | |
if($returnValue){ | |
return $result->fetch_assoc(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment