Php 您的SQL语法有错误;检查与MySQL服务器版本对应的手册,了解正确的语法

Php 您的SQL语法有错误;检查与MySQL服务器版本对应的手册,了解正确的语法,php,mysql,stored-procedures,Php,Mysql,Stored Procedures,我将此页制作如下: <?php $host="localhost"; $user="root"; $password=""; $database="student"; $link= mysqli_connect($host,$user,$password,$database); if(isset($_POST['btnsave'])) { $reg=$_POST['reg']; $name=$_POST['name']; $trade

我将此页制作如下:

   <?php
   $host="localhost";
   $user="root";
   $password="";
   $database="student";
   $link= mysqli_connect($host,$user,$password,$database);

  if(isset($_POST['btnsave']))
 {
  $reg=$_POST['reg'];
  $name=$_POST['name'];
  $trade=$_POST['trade'];
  $college=$_POST['college'];
  $query="CALL insert($reg,'$name','$trade',$college)";

  $res=  mysqli_query($link,$query);
  if(mysqli_affected_rows($link)==1)
  {
      echo 'Data Saved';
  }
  else
  {
      print_r(mysqli_error($link));
  }

  }
  ?>


  <html>
  <head>
    <meta charset="UTF-8">
    <title></title>
   </head>
   <body>
    <form name="form" action="stored_procedure.php" method="post">
    <table border="2">
        <tr>
            <td>Reg No</td>
            <td><input type="text" name="reg">
        </tr>
        <tr>
            <td>Name</td>
            <td><input type="text" name="name"></td>
        </tr>
        <tr>
            <td>Trade</td>
            <td><input type="text" name="trade">
        </tr>
        <tr>
            <td>College</td>
            <td><input type="text" name="college"/></td>
        </tr>
        <tr>
            <td colspan="2">
                <input type="submit" name="btnsave" value="Save"/>
                <input type="submit" name="btnupdate" value="Update"/>
                <input type="submit" name="btndel" value="Delete"/>
            </td>
        </tr>
    </table>
    </form>
    </body>
   </html>
提交表单后,会出现以下错误:

您的SQL语法有错误;查看与您的MySQL服务器版本对应的手册,以了解可在附近使用的正确语法
在第1行“插入(6546,'dffgd','teredr',432)”


我做了一切,但无法修复此错误,请帮助我解决此错误。

您已将存储过程名称用作“insert”,这是mysql的保留关键字,请尝试使用任何其他过程名称


示例:$query=“CALL myprocedure($reg,$name,$trade,$college)”

调用插入(…)
在我看来不像SQL。调用存储过程的d方法不是当过程名称是mysql中的保留字时…您的查询未定义
begin
insert student1 values(reg,name,trade,college);
end