NameSilo

Simple SQL not working!

Spacemail by SpaceshipSpacemail by Spaceship
Watch

SiKing

Registered MemberEstablished Member
Impact
6
Am I getting stupid in my young age or is my host just [insert rude word here]?

I've had many problems with my host so far and this is the second (simple) MySQL problem I've had today.

PHP:
$query = mysql_query( "SELECT * FROM certificates WHERE unique='1' ORDER BY title ASC" ) or die("SELECT Error: " .mysql_error());

Returns:

SELECT 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' ORDER BY title ASC' at line 1

Hopefully I'm just stupid. Thanks.


Furthermore: when I changed 'unique' to 'category', it worked fine. These two fields are identical in the database (including properties) so the only way it could be wrong is if 'unique' is not spelt the same way it is in the database and i've checked it billions of times.
 
Last edited:
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
"unique" is a mysql keyword.

Try changing the field name to is_unique or similar.
 
1
•••
Muchas gracias amigo. Rep added!
 
0
•••
Dynadot — .com Registration $8.99Dynadot — .com Registration $8.99

We're social

Unstoppable Domains
Domain Recover
DomainEasy — Zero Commission
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back