Home > Backend Development > PHP Tutorial > 怎么添加2条数据到数据库

怎么添加2条数据到数据库

WBOY
Release: 2016-06-23 14:23:10
Original
889 people have browsed it

怎么添加2条数据到数据,只有$parent_area ,$fparent_area area这个值变化,其它都不变
我这样直接加代码上去,不能添加2条数据,被覆盖了,高手指教了,直接给完整代码谢谢了

                        $insert="insert into `goods_area` (goods_id,city,area,end_time) values ('$id','$city','$parent_area','$endTime')";                        @mysql_query($insert);                        $insert="insert into `goods_area` (goods_id,city,area,end_time) values ('$id','$city','$fparent_area','$endTime')";                        @mysql_query($insert);
Copy after login


回复讨论(解决方案)

不会覆盖吧,应该一条失败了
看mysql??error

应该看看你的表设计,比如id是不是主键或者唯一

不然你的这2条应该是可以插入进去的

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template