我正在使用这个:
foreach($affid as $id) {
$id = @mysql_real_escape_string(strip_tags($id));
$otherid = $_POST['postid'];
$sql = "UPDATE dlbprog SET affId=".$id." WHERE id=".$otherid;
echo $sql;
//@mysql_query($sql) or die(mysql_error());
}
结果是这样的:
UPDATE dlbprog SET affId=323 WHERE id=5
UPDATE dlbprog SET affId=424 WHERE id=5
而我想让它说:
UPDATE dlbprog SET affId=323 WHERE id=1
UPDATE dlbprog SET affId=424 WHERE id=5
(它将最后一个结果保留为当前结果)
这是我的表格:
<table border="1" width="90%" align="center" cellspacing="0" cellpadding="2">
<tr>
<td align="left" colspan="2">'.$row["description"].'</td>
</tr>
<tr>
<td align="left" width="55%">
To Sign Up <a href="'.$row["progUrl"].'" target="_blank">Click Here</a>
<br />
<input type="checkbox" name="blocked" value="'.$row['ownerId'].'" />
Block this program
</td>
<td align="left" width="45%">
Your Affiliate Id:
<input type="text" class="input" size="30" name="affid[]" value="'.$row['affId'].'">
<input name="postid" value="'.$row["id"].'">
</td>
</tr>
</table>
<p> </p>