Hi.


I installed  MySQL 5.0.1 (snapshot) and PHP 5.0.2 (compiled 

--with-mysql=../mysql-debug-5.0.1-alpha-pc-linux-i686 
--with-mysqli=../mysql-debug-5.0.1-alpha-pc-linux-i686/bin/mysql_config).



Your code really doesn't work when I used 



$mysqli=mysqli_connect('localhost', 'root','s','test',3807,"/tmp/mysql.sock.gleb.3")



to connect to the server.



But when I changed that to 



$mysqli=mysqli_init();

$mysqli->real_connect('localhost', 'root','s','test',3807,"/tmp/mysql.sock.gleb.3");



Everything works fine. It might be a PHP bug.  I posted your message with my comments 
to [EMAIL PROTECTED]



My code:



<?

$mysqli=mysqli_init();

$mysqli->real_connect('localhost', 'root','s','test',3807,"/tmp/mysql.sock.gleb.3");

//$mysqli=mysqli_connect('localhost', 'root','s','test',3807,"/tmp/mysql.sock.gleb.3");

$ok = $mysqli->multi_query("call test();");

echo $mysqli->info;

//$ok = $mysqli->multi_query("select * from t1;");

//if($ok) {

//echo "<p>OK</p>\n";

//echo $mysqli->mysqli_errno()."\n";

//echo $mysqli->mysqli_sqlstate."\n";

do {

echo "<p>result</p>\n";

$result = $mysqli->store_result();

if($result) {





 while ($line = mysqli_fetch_array($result, MYSQL_ASSOC)) {

 echo "\t<tr>\n";

 foreach ($line as $col_value) {

 echo "\t\t<td>$col_value</td>\n";

 }

 echo "\t</tr>\n";

 }



 $result->close();

 }

 } while($mysqli->next_result());

 //}

 ?>







Michael Kofler <[EMAIL PROTECTED]> wrote:

> Hi,

> 

> I am using MySQL 5.0.1 (snapshot) and PHP 5.0.2 with mysqli interface 

> (latest snapshot) under Linux (SUSE 9.1).

> 

> I would like to call a SP using PHP 5, and I want to get back the SELECT 

> results.

> 

> This is my SP:

> 

> CREATE PROCEDURE `test`()

> BEGIN

>   SELECT * FROM t1;

> END

> 

> From the comments in http://bugs.mysql.com/bug.php?id=2273 I understand I 

> have to use mysqli_multi_query if I want to get rowsets from a SP. Fine:

> 

>   $ok = $mysqli->multi_query("CALL test()");

>   if($ok) {

>     echo "<p>OK</p>\n";

>     do {

>       echo "<p>result</p>\n";

>       $result = $mysqli->store_result();

>       if($result) {

>         show_table($result);  // shows result details

>         $result->close();

>       }

>     } while($mysqli->next_result());

>   }

> 

> I don't get any results, $ok is FALSE.

> 

> If I instead use the following code, everything works fine, I receive both 

> rowsets. So, the PHP code above seems to be ok as long as I don't call a SP.

> 

> $ok = $mysqli->multi_query("SELECT * FROM t1; SELECT * FROM t1");

> 

> Any ideas? Error in MySQL or in PHP?

> 

> Thank you,

> 

>              Michael Kofler

> 

> http://www.kofler.cc/

> 



-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.NET http://www.ensita.net/
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Gleb Paharenko
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.NET
       <___/   www.mysql.com




-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to