stored Procedures getting started

Discussion in 'PHP' started by progfrog, Dec 17, 2008.

  1. #1
    Hi!
    I'm starting to use the SP in my DB. thus, I have some questions about it:

    1.I'm using WAMPSERVER- How can I access the storedProcedures from phpmyadmin?

    2. Where do i write the SP? in php script or in the console?

    3.When I want to call the SP does it have to be called from within the SQL connection?

    This is my code- I wrote it in the php script but it doesn't work

    
    
    <?php
    $mysql_link= mysql_connect('localhost','root','') or die("ERROR:cannot 
    
    connect");
    echo "connected successfully to MySQL server.";
    
    mysql_select_db('pets',$mysql_link) or die ("could not open db".mysql_error());
    echo "connected successfully to pets.";
    DELIMITER //
    CREATE PROCEDURE InsertData(IN Bname varchar(10) )
    BEGIN
    INSERT INTO exprience (BookNname)
    VALUES (Bname);
    END //
    DELIMITER ;
     
    CALL InsertData ('Oliver Twist');
    mysql_close($mysql_link);
    
    ?>
    Plz Help
    
    Progfrog
    
    
    
    
    Code (markup):
     
    progfrog, Dec 17, 2008 IP