Jump to content

couldn't fetch mysqli_result


jlrough

Recommended Posts

I got this error on the line on the while line (36) with fetch_assoc.  I am seeing this error in firebug on the AJAX response.

It looks like I am only getting the first row of the result.  Mysql community 5.1, Thanks,

 

Success... 127.0.0.1 via TCP/IP

<br />

<b>Warning</b>:  mysqli_result::fetch_assoc() [<a href='mysqli-result.fetch-assoc'>mysqli-result.fetch-assoc</a>]: Couldn't fetch mysqli_result in <b>/Library/WebServer/Documents/ajax/get_todosx2.php</b> on line <b>36</b><br />

array(1) {

  [0]=>

  array(3) {

    ["todo"]=>

    string(22) "What needs to be done?"

    ["date"]=>

    string(10) "0000-00-00"

    ["name"]=>

    string(8) "By whom?"

  }

}

 

 

 

 

$mysqli = new mysqli($dbhost,$dbuser, $dbpass, $dbname,$dbport);

if ($mysqli->connect_error) {

    die('Connect Error (' . $mysqli->connect_errno . ') '

            . $mysqli->connect_error);

}

echo 'Success... ' . $mysqli->host_info . "\n";

$sql = 'SELECT todo,date,name FROM task WHERE todo > "" ';

$result = $mysqli->query($sql);

if ($result){

$arr_result = array();

 

while($row = $result->fetch_assoc())){

    $arr_result[] = $row;

 

}//end while

 

}//end if

 

Link to comment
https://forums.phpfreaks.com/topic/265173-couldnt-fetch-mysqli_result/
Share on other sites

I removed the stray parenthesis and i still get the same error message on line 36. 

I even cleared the firefox cache to make sure.

I  also have the error message set and sent to the error log . I can read it in the firebug console. 

That is where I am getting the following message from.

ini_set('error_reporting', E_ALL);

error_log("get_todosx error",3,"/var/tmp/Janis-Rough.local.err");

 

Success... 127.0.0.1 via TCP/IP

<br />

<b>Warning</b>:  mysqli_result::fetch_assoc() [<a href='mysqli-result.fetch-assoc'>mysqli-result.fetch-assoc</a>]: Couldn't fetch mysqli_result in <b>/Library/WebServer/Documents/ajax/get_todosx2.php</b> on line <b>36</b><br />

array(1) {

  [0]=>

  array(3) {

    ["todo"]=>

    string(22) "What needs to be done?"

    ["date"]=>

    string(10) "0000-00-00"

    ["name"]=>

    string(8) "By whom?"

  }

}

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.