The query itself:
select * from t where username = 'jim'
As far as getting True or False from this, you'll need to write a function that processes the results and gets you a boolean answer. The return value of mysql_query() can be false, but all that means is that the query was invalid for some reason (and making a query that happens to return no rows is not invalid.)
So, assuming you define 'truth' in this case to mean "one or more matching records", you might have something like this:
function does_user_exist( $usr )
{
$qry = "select username from t where username = '$usr' ";
if ($result = mysql_query( $qry ))
{
$count = mysql_num_rows($result);
mysql_free_result($result);
}
return ($count > 0);
}
Note this does not distinguish user-not-found from query errors.