I'm trying to parse out my if-else statements nicely but it seems that it doesn't parse out the else statement.
$a = 1
if (is_numeric($a))
{
$DB = new PDO('sqlite:database.db');
$result = $DB->query('select id from staff where id='.$a);
if ($result == "")
{
echo "'{$a}' is invalid. No such record", PHP_EOL;
}
else
{
echo "'{$a}' is found", PHP_EOL;
}
}
else
{
echo "'{$a}' is NOT numeric", PHP_EOL;
}
My $result I think it will return in Integer as when I say to echo the $ result out, it says PDO statement cannot be converted to INT. It doesn't go to my first inner else statement. Please advise how did I make my mistake.
Thanks