2016-04-20 87 views
0

我有这个查询显示两个输入值,因为ID字段在表中找到两次。在字段中编辑几个值

<form action="edit_batch.php" method="post" > 
$sql="select Batch_Name from claims_follow_up.batch where id='$id'"; 
$req=mysqli_query($dbc,$sql) or die("Erreur d'execution"); 
while($tab=mysqli_fetch_array($req)) 
{    
?> 
<label>Batch Name</label> 
<input type="text" name= "batch" value='<?=$tab['Batch_Name']?>' required><br> 
    <?php 
    } 
    ?> 
</form> 

我想编辑这些值,但是我失败了,在这里我如何努力:

edit_batch.php

include_once('connection.php'); 
$batch=mysqli_real_escape_string($dbc,$_POST['batch']); 
$belong=intval($_POST['belong']); 
$sql = "update claims_follow_up.batch set Batch_Name='$batch' where belong='$belong'"; 
$res = mysqli_query($dbc, $sql); 

任何帮助,将不胜感激!

回答

0

UPDATE语法不包含VALUES关键字。

检查参考:http://dev.mysql.com/doc/refman/5.7/en/update.html

VALUES用于INSERT。

+0

非常感谢我的错误我纠正它,它仍然不工作 – baptpro

+0

任何人都可以帮助我吗? – baptpro

+0

你能得到实际的sql错误信息吗?否则真的很难猜到出现了什么问题 – ggg