samedi 25 avril 2015

php database - is_int returns false always

I have written a simple sql query and is_int() returns alway false. why?

mysql query

$sql = "SELECT id, username FROM users WHERE email = 'mail@example.com' LIMIT 1"; 
$data = $db->query($sql); 
# output: php array like $data[0]['id'];

php if

if( is_int($data[0]['id'] ){
  print 1;
}else{
  print 0;
}

Aucun commentaire:

Enregistrer un commentaire