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
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?"

  }

}

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.