UPDATE `news` SET `title`=title WHERE `newsid`=newsid;-----------------------------you set the name of the innerVariables same as the column name.
change them asCREATE PROCEDURE `UpdateNews`(in newsid int, in title varchar(50))
BEGIN
SET @a=newsid;
SET @b=title;
UPDATE `news` SET `title`= @b WHERE `newsid`= @a;
ENDorCREATE PROCEDURE `UpdateNews`(in a int, in b varchar(50))
BEGIN
UPDATE `news` SET `title`=b WHERE `newsid`=a;
END

解决方案 »

  1.   

    再不行的话,你到php.net上去下个扩展包,那里面比较全
      

  2.   

    问题今天已经解决了。
    我想调用一个存储过程,让它返回一个值,我该怎么写呢?use mysqli
      

  3.   

    比如说我的存储过程如下
    CREATE PROCEDURE `Show`(in id int)
    BEGIN
    select * from news where `newsid`=id;
    END在PHP中执行
    mysqli_query("call aa(1)");
    我想在PHP中知道它是否有newsid为1这条新闻
    是不是在存储过程参数中加个out变量或是其它什么办法?
      

  4.   

    CREATE PROCEDURE `UpdateNews`(in a int, in b varchar(50))
    BEGIN
    declare cnt int;
    declare return_code int;
    UPDATE `news` SET `title`=b WHERE `newsid`=a;
    select count(title) from news into cnt;
    set return_code = cnt;
    select return_code;
    END我也初学.不对不要见怪
      

  5.   

    yttlovezxx(月亮岛):
    select count(title) from news into cnt;不是这样用的
    应该是select count(title) into cnt from news;我想要的是满足newsid为1的这一条记录,最好再加上如果有记录的话就返回一个值,无记录返回另一个值