Hi,
I have some MySQL questions. First, can I use combination operators in a query? For example:
$query = "SELECT * FROM schedule " .
"WHERE user_id = '$user', task_id = '$task_to_add', work_id = '$time_to_add'";
$result = mysql_query($query)
or die(mysql_error());
if (mysql_num_rows($result) != 0)
{
$query = "UPDATE schedule " .
"SET time += '$time_to_add'" .
"WHERE user_id = '$user', task_id = '$task_to_add', work_id = '$time_to_add'";
$result = mysql_query($query)
or die(mysql_error());
}
I am checking if there is an entry that fits my criteria and if so, I am adding more time to the it. If I can't do this, how would I do this?
And secondly, In this same example, I had to re-do the search when updating. Is there any way to just use the previous query in the next one?
Thanks
Hailey