0
朋友們,我將字段名稱顯示爲數據庫的值1和值作爲字段的結果,但我無法提高它以保存字段的值。更新while和php
$result = $db->query($query);
while($rowID = $result->fetchArray()){
echo
" <label class=\"control-label \" for=\"text\">
".$row['value1'] ."
</label>
<input class=\"form-control\" value=".$rowID['value2'] ." id=\"\" name=".$rowID['id']." type=\"text\"/>
</div>";
}
if(isset($_POST['submit_data'])){
$ret1 = $db->query($query);
while($rowID = $ret1->fetchArray())
{
$query = "UPDATE table set value2 ='" . $_POST[$rowID['id']] . "' WHERE id='" . $rowID['id'] . "'";
}
if($db->exec($query)){
$message = "Data is updated successfully.";
}else{
$message = "Sorry, Data is not updated.";
}
}
您顯示的是value1,並存儲了value2。 –
http://bobby-tables.com - 瞭解SQL注入。您的腳本處於非常高風險之中,您的數據庫可能會在幾秒鐘內被黑客入侵! – Twinfriends