pstevereynolds Posted July 7, 2008 Share Posted July 7, 2008 I've looked through the forums and read through www.mysql.com and php.net, etc. I'm sure I'm missing something really simple. I'm playing with Stored procedures using php 5.03 and Mysql 5.0.27 with client 5.0.51a. I'm having an issue calling the same stored procedure twice. here's the very dumbed down code that I'm trying to get working. <?php include_once("db_mysqli_connection.php"); echo "database connected in test.php. <br />"; echo "Query is get_downline.<br />"; $userID = 2; $query = "call get_downline ($userID)"; $result = mysqli_multi_query($link,$query) or die ("query - call failed : " . mysql_error()); $result = mysqli_store_result($link); $row = mysqli_fetch_array($result, MYSQL_ASSOC); $username = $row['FirstName'].' '.$row['LastName']; $userID = $row['ID']; echo "user is ".$username." with userid = ".$userID."<br />"; $query = "call get_downline ($userID)"; echo "Try calling the query again.<br />"; mysqli_free_result($result); $userID = 4; $query = "call get_downline ($userID)"; echo "query renamed as query2.<br />"; $result = mysqli_multi_query($link,$query) or die ("query2 - call failed : " . mysql_error()); $result = mysqli_store_result($link); $row = mysqli_fetch_array($result, MYSQL_ASSOC); $username = $row['FirstName'].' '.$row['LastName']; $userID = $row['ID']; echo "user is ".$username." with userid = ".$userID,"<br />"; echo "end"; ?> I get this output: database connected in test.php. Query is get_downline. user is Mary Smith with userid = 4 Try calling the query again. query renamed as query2. query2 - call failed : Notice there is not an error message to look up. I don't understand what I'm doing wrong. Why can't I call the same procedure a second time. I'm using the mysqli_free_result. Any help is much appreciated. Thanks, Steve Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted July 7, 2008 Share Posted July 7, 2008 could it be a variable type issue with the redeclaration of the userid? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.