I'm using SQLite3 and PHP to create a little class, this means I don't want any plugins or other classes, just plain SQLite3 and PHP.
Currently I'm trying to retrieve values from a database, but I want to check if there is a result or not with that conditions:
$select = $db->query("SELECT * FROM views WHERE address = '$ip' AND page = ''");
After some search I couln't find nothing specific, but I think I'm missing it.
First I tried:
if($select){
// result returned
}else{
// no results
}
And then this solution worked(the previous always failed):
while($row = $select->fetchArray(SQLITE3_ASSOC) ){
$exists = TRUE;
break;
}
if($exists == TRUE){
// result returned
}else{
// no results
}
But this seems to be, tricky... is there a way to check if a select query returned something or nothing?