PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I am currently working on a project that allows users to say when they are done with a certian type and change an entry in the table from incompleted, to u_completed.
I want to make sure that it is only for one type ($type), and only for that user ($_SESSION['uid']).
Is it possible to use two where clauses in an update? If so how do I?
$sql = mysql_query("UPDATE stories set `action` ='u_completed' where `user_id`='{$_SESSION[uid]}' and where `type`='$type'") or die(mysql_error());
and I get this error
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'where `type`='digg'' at line 1
Firstly, I believe the correct syntax for the array *is* with the quotes like you originally had. Secondly, if MySQL says that the column doesn't exist, then there is no column 'user_id' in the 'stories' table. Are you sure that you are looking at the right table?
superdezign wrote:Firstly, I believe the correct syntax for the array *is* with the quotes like you originally had. Secondly, if MySQL says that the column doesn't exist, then there is no column 'user_id' in the 'stories' table. Are you sure that you are looking at the right table?
Wow. I feel so stupid right now. I was looking at the wrong table.