bmmayer Posted October 8, 2008 Share Posted October 8, 2008 I am trying to run a very simple test script. This one works: <?php $link = mysqli_connect("localhost", "******", "******", "*******"); $result = mysqli_query($link, "SELECT FOO FROM BENCHMARK"); while($get = mysqli_fetch_object($result)){ echo $get->FOO."<br />"; } ?> This one doesn't work: <?php $link = mysqli_connect("localhost", "******", "******", "*******"); $result = mysqli_query($link, "SELECT * FROM BENCHMARK"); while($get = mysqli_fetch_object($result)){ echo $get->FOO."<br />"; } ?> In the second one, instead of "SELECT FOO FROM" I did "SELECT * FROM" (which you're totally allowed to do, right? WRONG. It seems that when I say "SELECT * FROM" mysqli_fetch_object (or mysqli_fetch_array) doesn't work. The weirdest thing is, it doesn't even return an error in the browser, it just comes up blank! Is this a PHP config issue or a code issue, or both? I should note that using mysql not mysqli works fine here, but we need mysqli for the app we're building so we can't use just mysql. Thanks for y'all's help in advance. -b Link to comment https://forums.phpfreaks.com/topic/127513-mysqli-requires-key/ Share on other sites More sharing options...
bmmayer Posted October 8, 2008 Author Share Posted October 8, 2008 And a follow up...so WEIRD This code gives this error: Warning: mysqli_fetch_object() expects parameter 1 to be mysqli_result, boolean given in /home/*****/public_html/new/mysqli_test.php on line 7 <?php $link = mysqli_connect("localhost", "*******", "********", "********"); $result = mysqli_query($link, "SELECT (*) FROM BENCHMARK"); while($get = mysqli_fetch_object($result)){ echo $get->FOO."<br />"; } ?> Link to comment https://forums.phpfreaks.com/topic/127513-mysqli-requires-key/#findComment-659734 Share on other sites More sharing options...
PFMaBiSmAd Posted October 8, 2008 Share Posted October 8, 2008 Your query failed for some reason. Use the mysqli_error() function to get mysql/php to tell you why. Link to comment https://forums.phpfreaks.com/topic/127513-mysqli-requires-key/#findComment-659736 Share on other sites More sharing options...
bmmayer Posted October 8, 2008 Author Share Posted October 8, 2008 error reporting is on! and even when i include mysqli_error() it still doesn't display it! in Safari it says "the server dropped the connection" It isn't a typical mySQL bug, its something else. I've never seen the browser not make a server connection at all because of a mysql error... Link to comment https://forums.phpfreaks.com/topic/127513-mysqli-requires-key/#findComment-659990 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.