MySQL Forums
Forum List  »  PHP

PHP Lost Connection..
Posted by: Andrew Gilfrin
Date: April 24, 2005 03:39PM

I'm trying to use the following PHP code to call two MySQL Stored Procedures...

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<?php
ini_set("display_errors", 1);

$link = mysqli_connect("localhost", "root", "trustno1");

if (mysqli_connect_errno()) {
die ("Error connecting MySQL: ".mysqli_connect_error());
}

mysqli_select_db($link,"pers");

if ($result = mysqli_query($link,"call getCountries()")) {
while ($row = mysqli_fetch_array($result)) {
echo $row[0].'<br>';

$query = "call getCapitals(\"".$row[0]."\")";

if ($result2 = mysqli_query($link,$query)) {
while ($row2 = mysqli_fetch_array($result2)) {
echo $row2[0].'<br>';
}
} else { echo mysqli_error($link); }
}
}
?>

It loops through the outer loop OK but when trying to do the inner loop I first get..

Lost connection to MySQL server during query

and then on subsequent calls get

MySQL server has gone away

Any ideas ?

Andrew Gilfrin
------------------
http://gilfster.blogspot.com
My MySQL related Blog

http://www.mysqldevelopment.com
MySQL Stored Procedure,Trigger, View.... (Just about most things these days) Information

Options: ReplyQuote


Subject
Written By
Posted
PHP Lost Connection..
April 24, 2005 03:39PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.