Log in

View Full Version : SQL SELECT Help


Adrian Schneider
01-21-2005, 06:18 AM
Having some troubles with db queries, is this the right order to do everything in? Trying to figure where I went wrong. :ermm:
mysql_query("SELECT 'rating' FROM 'user' WHERE username='TheSpecialist' LIMIT 1");

FYI: Rating is a field I added to the user table. If I assign the whole mysql_query statement a variable, I should get it to display the result right?

Tekton
01-21-2005, 06:25 AM
$yourvar= $DB_site->query("SELECT rating FROM user WHERE username = 'TheSpecialist' LIMIT 1");

or

$yourvar= $DB_site->query_first("SELECT rating FROM user WHERE username = 'TheSpecialist'");

----

echo $yourvar[rating];