DTP


 
Lively discussions on the graphic arts and publishing — in print or on the web


Go Back   Desktop Publishing Forum > General Discussions > Web Site Building & Maintenance

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 12-16-2006, 12:16 PM   #1
LenHewitt
Member
 
Join Date: Feb 2005
Location: Derby, UK
Posts: 6
Default PHP5x -> MySQL 5 Stored Procedure Problem

If anyone has an explanation for the following problem I would be very grateful:

A call to a MySQL S/P works fine, but if I then make a subsequent call to a 2nd S/P the connection to the MySQL server is lost. Here's the code that fails:
<?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_errno($mysqli));
$check_account = $result->fetch_row();
return $check_account;
}
function get_account ($id, $mysqli){
$query="CALL admin_get_acct_details($id)";

$result1 = $mysqli->query($query)
or die ("$query : ".mysqli_error($mysqli));
//[fails here - Error msg: CALL admin_get_acct_details(598): Lost Connection to MYSQL Server]
$account = $result1->fetch_assoc();
return $account;

}
$account_id = check_account('B0000', $mysqli);
$id = $account_id[0];
$account = get_account($id, $mysqli);

print_r($account);
?>

It's not a problem in the S/P since the following works:

<?php

$mysqli = new mysqli($hostname, $username, $password, $db);
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();
return $account;

}
$id = 598;
$account = get_account($id, $mysqli);
print_r($account);
?>
LenHewitt is offline   Reply With Quote
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP/MySQL Forum dthomsen8 Web Site Building & Maintenance 7 03-18-2007 05:13 AM
Weird MySQL problem iamback Web Site Building & Maintenance 37 06-05-2006 11:04 PM
mySQL vs SQL Server LoisWakeman Web Site Building & Maintenance 3 05-25-2006 11:18 PM
Help! PHP/MySQL problem annc Web Site Building & Maintenance 14 07-15-2005 01:09 PM


All times are GMT -8. The time now is 10:50 AM.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Contents copyright 2004–2014 Desktop Publishing Forum and its members.