I am very new to php and I am trying to write a few simple php scripts just to get a feel for the language.
I am having a problem with one script that keeps on returning this warning message:
Warning: mysqli_free_result() expects parameter 1 to be mysqli_result, boolean given in /home/solare11/public_html/rk/test-connect.php on line 27
Source line 27 is:
I am not attempting to write cutting edge code here, I just want to experiment with how certain things work. So, I am not interested in recoding this as PDO, nor security faults etc. I just want to know what is wrong with this code and how I should correct it.
I have read the php documentation and searched the web for answers to this and I have seen so many different answers that I am just totally confused ???
Can any friendly person out there give me a solution?
HERE IS MY SOURCE:
[php]// define database variables
$host = ‘localhost’;
$user = $_SERVER[‘DBUSER’];
$pass = $_SERVER[‘DBPASS’];
$db = $_SERVER[‘DBRK’];
if(mysqli_connect_errno()) die('Connection Error ‘.mysqli_connect_errno().’ : '.mysqli_connect_error());
We are here 01
$query=“SELECT * FROM customer”;
echo "Customer id: " . $row[‘custid’] . " Password: " . $row[‘password’] . “
We are here 02
$query=“UPDATE customer SET password=‘aaabbb’ WHERE custid=‘71’”;
” . $result02;