If you're only expecting one value from one row, it would make more sense to call [man]mysql_result/man instead.
EDIT: Also note that user-supplied data should never be placed directly into a SQL query string, else your code will be vulnerable to SQL injection attacks and/or just plain SQL errors. Instead, you must first sanitize it with a function such as [man]mysql_real_escape_string/man (for string data; for numeric data, you could cast the data to the appropriate type, e.g. (int), or use something such as [man]intval/man or [man]sprintf/man).