0
因此,我創建了一個管理頁面,該頁面根據我們數據庫中有多少用戶創建了X個表單,每個用戶都有一個提交按鈕,提交對我們在數據庫中的日期的更改。我的問題是,當我想獲得張貼的價值時,我無法從張貼的東西中準確提取我需要的東西。它會保存到一個數組打來電話,當我print_r的數組我得到正是我想要的,那就是:嘗試使用動態創建的表單更新數據庫中的日期
[1] => "whatever date they typed in"
(obviously the 1 changes depending on which item they changed the date of)
我需要能夠通過查詢我的DATEBASE:
UPDATE users SET subdate="whatever they typed in" WHERE id="the array reference number"
我知道到底我需要做的,我只是不熟悉SQL,因爲任何幫助將不勝感激。提前致謝。
參考代碼:
<div class="form-section grid12" id="changedates">
<h1>Change Dates</h1>
<?php
$query = mysql_query("SELECT * FROM users WHERE admin='y'");
?>
<table>
<?php
while($row = mysql_fetch_assoc($query)) {
?>
<tr>
<td>
<h5><?php echo $row['displayname'];?></h5>
</td>
<td>
<form action="" method="POST">
<input type="text" name="subdate[<? echo $row['id'] ?>]" value="<?php echo $row['submissiondate'];?>">
<input type="text" name="nextupdate[<? echo $row['id'] ?>]" value="<?php echo $row['nextupdate'];?>">
</td>
<td>
<input type="submit" value="Set Date" name="setdate">
</form>
</td>
<?php
}
?>
</table>
</div>