I am trying to insert different jobs into a database and i want to check if there already is an entry for that job in the table. The idea was to use an SQL Statement that returns either true or false depending on the job existing in the table or not.
The connection is propperly established and i can get the values from a column using a SELECT statement as an array by using a similar syntax.
$sql = "SELECT COUNT(*) FROM job WHERE key = Pilot";
$result= $db->executeQuery($sql);
if($result == true) {
// action 1
}
else{
// action 2
}
the result from the executeQuery($sql)
is a boolean but it always returns false
, whether the job already exists or not but i was hoping to get true
when the job exists.