hi, i get this error when i run my script
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in E:\xampp\htdocs\autogh\admin\userindex\scripts\banner.php on line 13
this is my mysql statement
$banners_num = "select * FROM banners WHERE DATE_ADD(todate, INTERVAL numDay DAY) > NOW() AND position='top_banner'";
Am trying to place ads on my site based on days and not impression.
here is my banner script
<?php
$links = array();
$image_file = array();
$banners_num = "select * FROM banners WHERE DATE_ADD(todate, INTERVAL numDay DAY) > NOW() AND position='top_banner'";
$banners_num = mysql_num_rows($banners_result);
$i = 0;
while($i < $banners_num)
{
$bannertype[$i] = mysql_result($banners_result,$i,"bannertype");
$numDay[$i] = mysql_result($banners_result,$i,"numDay");
$links[$i] = mysql_result($banners_result,$i,"bannerurl");
$image_file[$i] = mysql_result($banners_result,$i,"image_file");
$i++;
}
$count = count($links) -1;
$randnum = rand(0,$count);
if ($randnum == $_SESSION['randnum'])
{
$randnum = rand(0,$count);
}
$_SESSION['randnum'] = $randnum;
echo "<a href='//$links[$randnum]' target='_blank'><img src='../../ads/$image_file[$randnum]' width='390' height='200' /></a>
";
?>