I want to update data row But the problem is that it is updated All rows
this is my code:
[code=php]
$query = mysql_query(“SELECT *
FROM emp
JOIN inv ON emp.name=inv.empname
WHERE inv.empname='”.$name.”‘”)
or die (“mysql error query”);
$id = $_POST[‘id’];
$updatestartdate = date(‘d/m/Y’);
$updateenddate = date(‘d/m/Y’);
$status = $_POST[‘status’];
while ($rowshow = mysql_fetch_assoc($query)){
$timetoshow = unix_time($rowshow[‘timex’]);
//UPDATE
if (isset($_POST[‘Update’]) and $_POST[‘Update’] == ‘dataupdate’){
$updatestatus = mysql_query (“UPDATE inv SET
updatestartdate=’$updatestartdate’,
updateenddate=’$updateenddate’,
status=’$status’
WHERE id='”.$rowshow[‘id’].”‘”)
or die (“updatestatus Error”);
if (isset ($updatestatus)){
echo “<div class=’hidecontent’><h3 style=’background-color:#3F3F3F; padding:5px;’ align=’center’>
<font color=’#FFFFFF’>Update is done</font></h3><meta http-equiv=’Refresh’ content=’5; url=cpanel_user.php’ /></div>”;
} else {
echo “<div class=’hidecontent’><h3 style=’background-color:#FF0000; padding:5px;’ align=’center’>
<font color=’#FFFF00′>Update Error</font></h3></div>”;
}
}
Where is the problem?