Home > Backend Development > PHP Tutorial > php mysql insert into while 意外终止,该怎么处理

php mysql insert into while 意外终止,该怎么处理

WBOY
Release: 2016-06-13 12:35:21
Original
1083 people have browsed it

php mysql insert into while 意外终止

$result = mysql_query("SELECT uid , pid , cate<br />
                       FROM upcm");<br />
while($rows = mysql_fetch_row($result))<br />
{<br />
$arry = explode($sepr,$rows[2],5);<br />
$query = "INSERT INTO upcn(uid,pid,cate1,cate2,cate3,cate4,cate5)<br />
           VALUES('$rows[0]','$rows[1]','$arry[0]','$arry[1]','$arry[2]','$arry[3]','$arry[4]')";<br />
$result1 = mysql_query($query);<br />
if(!$result1)<br />
{<br />
echo "fail<br>";<br />
}<br />
}
Copy after login


mysql_fetch_row($result)获取查询的结果,逐条处理,处理后写进一个新的表里面,但是每次执行while循环总是还没执行完程序就终止了,没有处理完数据,把insert into 换成printf(“**”);代替插入操作,会将程序正确执行完毕,而且每次运行程序插入的条数不一,有时多有时少,请问大侠们什么情况这是,苦恼啊..

Related labels:
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