Following a call to MySQL 5 Stored Procedure the connection string:
$mysqli = new mysqli($hostname, $username, $password, $db);
is being reset, causing further calls to other stored procedures to fail with:
CALL admin_get_acct_details(598): Lost Connection to MYSQL Server
(where the (598) is the result from a previous call to a Stored Procedure.)
Test code is as follows:
<?php
$mysqli = new mysqli($hostname, $username, $password, $db);
function check_account($account, $mysqli){
$query = "CALL admin_get_acct('$account')";
$result = $mysqli->query($query)
or die(mysqli_error($mysqli));
$check_account = $result->fetch_row();
[COLOR=Blue]return [/COLOR]$check_account;
}
function get_account ($id, $mysqli){
$query="CALL admin_get_acct_details($id)";
$result1 = $mysqli->query($query)
or die ("$query : ".mysqli_error($mysqli));
$account = $result1->fetch_assoc();
[COLOR=Blue]return[/COLOR] $account;
}
$account_id = check_account('B0000', $mysqli);
$id =$account_id[0];
$account = get_account($id, $mysqli);
//[Error msg: CALL admin_get_acct_details(598): Lost Connection to MYSQL Server]
print_r/COLOR;
?>
If $mysqli is re-defined immediately before the call to function get_account(), the script works.
Anyone know why the $mysqli connection object is getting reset?