+ -
当前位置:首页 → 问答吧 → insert into 可不可以使用 where 语法

insert into 可不可以使用 where 语法

时间:2011-09-22

来源:互联网

小弟正在写档案上传系统
很简陋的档案上传

小弟想问insert into [dbname] (xxx,xxx,xxx) values (xxx,xxx,xxx) where xxx='xxx';
后面那句话可不可以成立?
我试了好几次都没办法,
都是档案上传失败

$str = "insert into bulletin (file_1,file_2,file_3,file_4) values ('$file_1','$file_2','$file_3','$file_4') where bulletin(serial)='$serial'";

请问一下该如何解决!!!!!
感谢各位

作者: 黑色死亡   发布时间: 2011-09-22

不行
但你可以先 select 出来后再用 php 判断要不要 insert

另外建议 insert 这样写
INSERT INTO db SET col1='$col1', col2='$col2'......

这样比较不会搞混栏位

作者: culaid   发布时间: 2011-09-22

热门下载

更多