Jump to content

MySQLi requires Key?


bmmayer

Recommended Posts

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

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.