Page 1 of 1

When a query returns NULL?

Posted: Mon Aug 21, 2006 10:04 am
by peperoni
Hi u all,

I'm have a query that returns a value NULL when de query is empty, i compare this way:

Code: Select all

$conForo = ConcetarForo();
$sqlForo = printf("SELECT pais_user FROM phpbb_users WHERE username = '%s'", $_SESSION['login']);
$query = mssql_query($sqlForo,$conForo);
$resul = mssql_fetch_array($query);
f ($resul[0] == NULL){
   echo 'Have no Country! ';
}
else{
   echo 'Have country! ';
}
But always print Have no Country! :(. How is the correct way of makin' that comparison if the register is NULL.

Thanks...

Posted: Mon Aug 21, 2006 12:30 pm
by protokol
Try calling

Code: Select all

sprintf
instead of

Code: Select all

printf

Posted: Tue Aug 22, 2006 11:17 am
by peperoni
Thanks! :lol: