I need to say something like the following, not sure how to do it though:
PHP Code:<?php
mysql_query (update table set lockedstatus='LOCKED' where username="all usersnames located in table");
?>
| SitePoint Sponsor |




I need to say something like the following, not sure how to do it though:
PHP Code:<?php
mysql_query (update table set lockedstatus='LOCKED' where username="all usersnames located in table");
?>
So basically, you want to update ALL entries?
In that case, you don't need where part.
-- Jelena --
PHP Code:mysql_query (update table set lockedstatus='LOCKED' where username="all usersnames located in table");
Mind the quotes, the query is a string:
Cheers,PHP Code:mysql_query("update table set lockedstatus='LOCKED'");
Pepe
Neanderthal Technology




Okay great thanks so much. Another quick question though, I need to say something like the following:
Select username from table where
department = variable
department2 = variable
etc
You know there is a mysql forum, right?
Anyway, in that case you'd use the AND operator between the two parts of the where clause.





You construct MySQL queries as normal strings, meaning you can concatenate (.) or place (properly validated) variables in a double quoted strings to construct the string dynamically.
You then just send that string to mysql via mysql_query or mysqli_query
Bookmarks