[英]update value in mysql table
我想在表格中編輯舊值
$row=mysql_fetch_row($res); //get two values in a row from mysql
$value
是從$_GET['value']
獲取的,其格式如下
<form action="renew.php?value='.$value.'" method="POST">
Enter your value: <br/>
<input type="text" name="firstvalue" size="30" value="'.$row[0].'"/><br/>
Enter another value:<br/>
<textarea name="secondvalue" col="10">'.$row[1].'</textarea><br/>
<input type="submit" value="Done!"/>
</form>
我想發布此表單,然后使用新的firstvalue和secondvalue更新mysql表中的舊值。 我現在被卡住了。
在renew.php中,我嘗試這樣做
$oldvalue=$_GET['value'];
print_r($oldvalue);
$newval1=$_POST['secondvalue'];
$newval2=$_POST['firstvalue']; // An unexpected syntax error for T_VARIABLE here
$query=sprintf("UPDATE tebo SET value1='%s',value2='%s' WHERE value1='%s' LIMIT 1",
$newval1,$newval2,$oldvalue);
mysql_query($query) or die("Unable to update the specified data. ".mysql_error());
$oldvalue=$_GET['value'];
$newval1=$_POST['secondvalue'];
$newval2=$_POST['firstvalue'];
$query="UPDATE tebo SET value1='".$newval1."',value2='".$newval2."' WHERE value='".$oldvalue."' ";
mysql_query($query) or die("Unable to update the specified data. ".mysql_error());
你忘了放; 在波紋管線上
$newval1=$_POST['secondvalue'];
$newval2=$_POST['firstvalue'];
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.