+ -
当前位置:首页 → 问答吧 → 关于图书管理系统 php+mySQL 的数据插入问题

关于图书管理系统 php+mySQL 的数据插入问题

时间:2011-04-13

来源:互联网

在插入图书数据时,想要系统检测若b_ID已存在就将其库存+1,若不存在则完整插入数据,由于数据库大程要求,临时学的php,不知道如何实现。。。

作者: berylzhangshuzhe   发布时间: 2011-04-13

create procedure pro(@name varchar(50),@number int)
as
declare @flag int;
begin
select book_name from test where book_name=@name;
set @flag = @@rowcount;
if @flag>0 
  update test set number=number+1 where book_name=@name;
else
  insert into test(book_name,number) values(@name,@number);
end;


execute pro 'PHP',1


写了一个存储过程,能实现你的功能不过不知道时不时你要的结果。

作者: python_   发布时间: 2011-04-13

热门下载

更多