search

Home  >  Q&A  >  body text

mysql - Problems with creating stored procedures in php

I use mysqli's process-oriented method to create stored procedures

<?php
$con = mysqli_connect('localhost', 'root', 'password', 'test');
if(mysqli_connect_errno($con)){
    return mysqli_connect_error;
}
$sql = "
CREATE PROCEDURE pro1(IN title varchar)
BEGIN
DELETE FROM user WHERE username=title;
END;
";
mysqli_query($con, $sql);
mysqli_close($con);

The stored procedure has not been created. What's going on?

I copied the sql statement into phpmyadmin and everything was fine·

phpcn_u1582phpcn_u15822773 days ago940

reply all(1)I'll reply

  • ringa_lee

    ringa_lee2017-06-07 09:25:11

    Type out the errors and see

    reply
    0
  • Cancelreply