Tag Archives: 批量更新

PHP数据记录批量更新代码

需要用到,简单是思路,记录一下。不过用到的应该不多。。。 一般会循环列出表记录到表单里 <?php$que=mysql_query("select * from test order by id ");         while($rs1=mysql_fetch_array($que))          {?>         <input  type="text" value="<?php echo $rs1['title'] ?>" name="title[]" size="2"><input  type="hidden" value="<?php echo $rs1['id'] ?>" name="id[]" size="2"><?php}?> 处理程序,搞个循环 $id=$_POST['id']; $title=$_POST['title']; if($num=count($id)){    for($i=0;$i<$num;$i++)         {          $q=mysql_query("update test set title=’".$title[$i]."’ where id=’".$id[$i]."’"); [...]

Page 1 of 1 1