I have created the function below;
To check if a record exists in the db or not, if record exists should return true, else false and currently returns the fourth column of the row which is the field $row['isannounced'].
The value will be true or false. But the problem is if the row is empty, the row count will still be 1. is there a better way to handle this?
Thanks in advance.
function isnotificationannounced($dspid, $clldsq, $clldtm){
//echo 'in : isnotificationannounced<br>';
$res=false;
$qry = "SELECT * FROM tbl_maindisplay_notification where (clldsq='$clldsq' AND clldtm='$clldtm' AND dspid='$dspid')";
//echo $qry;
$result = querydb($qry);
if ($result) {
$row = mysql_fetch_array($result);
//echo 'row data:<br>';print_r($row);
if(count($row)>0){
$res=$row[4];
//print_r($row);
}
} else {
die("existsindb: Query failed");
}
unset($clldsq, $clldtm, $tdcode);
return $res;
}