是不是也是先
mysql_connect("localhost","root","");
mysql_select_db("dbname");
$sql = "create procedure stu_sp1(IN seat int,OUT uname char(20))";
$sql .= "begin";
$sql .= "select stuName from stuinfo where stuSeat=seat into uname";
$sql .= "end";mysql_query($sql);mysql_query("call stu_sp1(1,@name)");我看网上说如果在php页面使用存储过程关键还要注意两点:(不知道这两点是不是必须写才能使用存储过程)关键就是两点1)define('CLIENT_MULTI_RESULTS', 131072);2)$link = mysql_connect("127.0.0.1", "root", "",1,CLIENT_MULTI_RESULTS) or die("Could not connect: ".mysql_error());
mysql_connect("localhost","root","");
mysql_select_db("dbname");
$sql = "create procedure stu_sp1(IN seat int,OUT uname char(20))";
$sql .= "begin";
$sql .= "select stuName from stuinfo where stuSeat=seat into uname";
$sql .= "end";mysql_query($sql);mysql_query("call stu_sp1(1,@name)");我看网上说如果在php页面使用存储过程关键还要注意两点:(不知道这两点是不是必须写才能使用存储过程)关键就是两点1)define('CLIENT_MULTI_RESULTS', 131072);2)$link = mysql_connect("127.0.0.1", "root", "",1,CLIENT_MULTI_RESULTS) or die("Could not connect: ".mysql_error());
$sql = "create procedure stu_sp1(IN seat int,OUT uname char(20))";
$sql .= "\nbegin";//\n
$sql .= "\nselect stuName from stuinfo where stuSeat=seat into uname;";//语句加;号
$sql .= "\nend";mysql_query($sql);mysql_query("call stu_sp1(1,@name)");
into 放的位置不对
$sql .= "\nselect stuName into uname from stuinfo where stuSeat=seat;";//语句加;号
1)define('CLIENT_MULTI_RESULTS', 131072); 2)$link = mysql_connect("127.0.0.1", "root", "",1,CLIENT_MULTI_RESULTS);