PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

mysqli::options> <mysqli::multi_query
Last updated: Fri, 10 Oct 2008

view this page in

mysqli::next_result

mysqli_next_result

(PHP 5)

mysqli::next_result -- mysqli_next_resultPrepare next result from multi_query

Description

bool mysqli::next_result ( void )
bool mysqli_next_result ( mysqli $link )

Prepares next result set from a previous call to mysqli_multi_query() which can be retrieved by mysqli_store_result() or mysqli_use_result().

Parameters

link

Procedural style only: A link identifier returned by mysqli_connect() or mysqli_init()

Return Values

Returns TRUE on success or FALSE on failure.

Examples

See mysqli_multi_query().



add a note add a note User Contributed Notes
mysqli::next_result
pawel dot barcik at gmail dot com
21-Jun-2008 05:26
this function returns FALSE when you have an error in your syntax in one of your queries, so be carefull with this type of construction when tracking errors:

<?php

//error in the second sub query 
$result = $db->multi_query("select * from news; seleeeeeeect id from news; update news set title='new title' where id= 12 ");

//code inside object class
$this->_db = new Mysqli($host, $user, $password, $database, $port, $socket);
       
do {
   
$result = $this->_db->store_result();
   
$this->_resultMulti[] = $result;
   
$this->_errnoMulti[] = $this->_db->errno;

    if(
is_object($result)) {
       
$result->free_result();
    }
               
} while(
$this->_db->next_result());

?>

in this construction all you have in the $this->_errnoMulti is :

array(1) {
  [0]=>
  int(0)
}
 
which means that there are no errors if you are not checking how many queries are executed!

mysqli::options> <mysqli::multi_query
Last updated: Fri, 10 Oct 2008
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites