Hi I have a query program where a user logs a query and when they log their query they get a query id and their username and query get logged at well as the date and time. I also have another form which updates the query when it is attended too or when it is closed which updates the rest of the feilds in that row. So now what im trying to do is that if the query is already been attended too it must give an error if another person trys to attend the same query bt if it hasnt been attended to then it must update the remaining feilds
$select = ("SELECT Count(*)as numrows FROM table WHERE approved=1 and Attendby='".$attend."'and queryId='".$id."'" );
$row = mysql_fetch_assoc($select);//mysql_query($select);
if($row['numrows']> 0)
{
echo"query already attended";
}
else
{
$call = intval($_POST[queryId]);
$sql="UPDATE tableSET CustomerDetails='$details',Department='$dept',AttendDate='$NewDate',AttendTime='$NewTime',CallType='$type ',Attendby='$attend ',QueryStatus='$status' Where QueryId= $id";
//header('Location:page.html');
}