Jump to content

Sending more than one stored procedure


tmatt95

Recommended Posts

Hi I am writing a php script for for my website to access a database. I can run one stored procedure alright, however when I try and run two the second does not want to run. I inserted some debugging code and it prints "failed 2" onto the screen even though the sql code will run in the mysql query browser. Below is the code I am trying to get to work:

 

$dblatestimage2 ="CALL bw_ProfileGetLatestUploadedImage(1)";
     /*calls random image */
    $latestimage2 = $db->query($dblatestimage2); 
    if ($latestimage2 == FALSE) {
        print "failed1";
        exit;
    }
     $row2 = $latestimage2->fetch_assoc();


    $dblatestimage3 ="CALL bw_ProfileUserIDGet('administrator')";
     /*calls random image */
    $latestimage3 = $db->query($dblatestimage3); 
    if ($latestimage3 == FALSE) {
        print "failed2";
        exit;
    }
     $row3 = $latestimage3->fetch_assoc();  

 

Can anyone help remove the error.

 

Thanks,

 

Matt

Link to comment
https://forums.phpfreaks.com/topic/139226-sending-more-than-one-stored-procedure/
Share on other sites

Sorry, but I have no idea :P Never got into stored procedures too much, and never had this particular problem.

Thanks for your help. I got a book for Christmas on stored procedures and they only have examples in which one is run :-[. Out of interest how do you code your database code in php?

 

Regards,

 

Matt

Depends on what I want to achieve... I usually have a separate class that creates a database connection as a singleton, and then separate classes for each database object (like users, messages) with static methods that take care of INSERTs UPDATEs etc... (those should be moved to namespaces, once PHP 5.3 is out)

 

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.