I have a relatively small problem that I just can't seem to fix.
I'll explain what it is that I want my script to do.
I need to check a MSSQL database to see if there is data for yesterday. If not, run the function that will get the data and put it in. THe function that gets the data runs great, I'm having a problem with checking to see if the data is there. Here's my code:
function checkPeakHour(){
//This function checks to see if the peak hour data is already in the database.
//It will return success if the data is there, else it will return false.
global $msdb;
$sql="select count(peakHour) count from peak_hour where convert(smalldatetime,convert(varchar(12),peakHour))='".setDate()."'";
$recordSet= &$msdb->Execute($sql);
$count=$recordSet->fields;
$count=$count['count'];
if($count < 1){
return(false);
}elseif($count > 0){
return(true);
}
}
I don't know where to go from here, the script always evaluates the comparison to $count being less than 1. When I var_dump($count) I get a int(0) returned, so wtf???
I will take a look at it later tonight or tomorrow and maybe a solution will come to me.
Thanks in advance for your help.