gearmelon
I've just had my account moved to a server running PHP 5 and am having some difficulty with the mysqli functions. Here's the message I'm getting:
Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in /home/mydir/public_html/mysite/usr/index.php on line 15
Here are lines 8-15:
$dbcnx = mysqli_connect('localhost', $_SESSION['db_username'], $_SESSION['db_pass'], $_SESSION['dbname']);
/* check connection */
if (!$dbcnx) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$sql = "SELECT * FROM `regions` LIMIT 1";
$result = mysqli_query($dbcnx, $sql);
$regions = mysqli_fetch_array($result, MYSQLI_BOTH);
I've checked the PHP manual for mysqli_fetch_array() and the above seems to conform to the right syntax. Wouldn't '$result = mysqli_query($dbcnx, $sql);' give the 'mysqli_result' expected, instead of the 'boolean given'? Can anyone see the trouble?
Thanks!
Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in /home/mydir/public_html/mysite/usr/index.php on line 15
Here are lines 8-15:
$dbcnx = mysqli_connect('localhost', $_SESSION['db_username'], $_SESSION['db_pass'], $_SESSION['dbname']);
/* check connection */
if (!$dbcnx) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$sql = "SELECT * FROM `regions` LIMIT 1";
$result = mysqli_query($dbcnx, $sql);
$regions = mysqli_fetch_array($result, MYSQLI_BOTH);
I've checked the PHP manual for mysqli_fetch_array() and the above seems to conform to the right syntax. Wouldn't '$result = mysqli_query($dbcnx, $sql);' give the 'mysqli_result' expected, instead of the 'boolean given'? Can anyone see the trouble?
Thanks!