Home  >  Article  >  Backend Development  >  请教多条更新记录提交怎么写SQL

请教多条更新记录提交怎么写SQL

WBOY
WBOYOriginal
2016-06-13 11:43:101026browse

请问多条更新记录提交如何写SQL
先上代码:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script><br /><script src="js/slide_up.js"></script><br /><meta charset="UTF-8"><br /><?php<br />require("inc/pdo.php");<br /><br />$select=$dbc->prepare("select id,slide_name,slide_href,slide_img from zt_slide");<br />$select->execute();<br />while($row=$select->fetch()){ ?><br /><br />焦点图管理<br /><form method="post" action="12.php"enctype="multipart/form-data"><br /><input type="text" id='id' name="id[]" value="<?php echo $row['id'];?>"><br/><br />名称<input type='text' id='slide_name' name="slide_name[]" value="<?php echo $row['slide_name'];?>"><br/><br />图片上传<input type='text' id='img'name="img[]" value="<?php  echo $row['slide_img']; ?>"><input type="file" id="file"name="file[]"><br/><br />文章地址<input type='text' id='slide_href' name="slide_href[]" value="<?php  echo $row['slide_href']; ?>"><br/><br /></div><br /><?php }?><br /><div id='insert_zt' class='slide'><br /><input type="hidden" name="action" value="focus"><br />名称<input type='text' id='slide_name' name="slide_name[]" ><br/><br />图片上传<input type='file' id='file' name="file[]"><br/><br />文章地址<input type='text' id='slide_href' name="slide_href[]"><br/><br /></div><br /><br /><button id="insert">增加一项</button><br /><input type="submit" id="submit"><br /></form>


提交到12.php
<?php<br />$id=$_POST['id'];<br />$name=$_POST['slide_name'];<br />$img=$_POST['img'];<br />$href=$_POST['slide_href'];<br /><br />foreach($id as $id1)<br />    {<br />        echo $id1."<br>";<br /><br />    }<br /><br />    foreach($name as $slide_name)<br />    {<br />        echo $slide_name."<br>";<br /><br />    }<br />	foreach($img as $slide_img)<br />    {<br />        echo $slide_img."<br>";<br /><br />    }<br />	foreach($href as $slide_href)<br />    {<br />        echo $slide_href."<br>";<br /><br />    }<br />//$sql="UPDATE tab SET  slide_name=$slide_name,img=$slide_img, WHERE id = $id"; 	请问SQL应该怎么写?<br />?>





请问如果在12.php 获取到多条记录后如何更新表

Statement:
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