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!
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 'unique='1' WHERE cid='3'' at line 1
$sql = mysql_query("UPDATE tl_stats SET unique='$unique' WHERE cid='$cid'") or die("Error: ".mysql_error());
The column `unique` DOES exist. If I change the name of the column [to say `test`], this query works, but it does not work when the column name is `unique`. Is unique some kind of keyword and this error is a result of that?
yacahuma wrote:good trick but I still think is not a good idea to use reserved words
It's perfectly fine to use reserved words for table and column names. Some of them are very descriptive and are exactly what we're looking for. Just because MySQL found them descriptive as well doesn't mean that other's should be banned from their use. A prime example of this is "date."