Possible Duplicate:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result
I have the following mysql query which is generating the above error and i can not work out why, any help would be appreciated.
$tableName="livetrack";
$targetpage = "visitors.php";
$limit = "$pagination";
$query = "SELECT COUNT(*) as num FROM $tableName where member_id = '$site_id' and display = 'yes'";
$total_pages = mysql_fetch_array(mysql_query($query));
$total_pages = $total_pages[num];
$stages = 3;
$page = mysql_escape_string($_GET['page']);
if($page){
$start = ($page - 1) * $limit;
}else{
$start = 0;
}
// Get page data
$query1 = "SELECT * FROM $tableName WHERE date >= ( NOW() - '$fdate' ) and ip ='$ip' and member_id = '$site_id' and display = 'yes' and category= '$categories' and type ='$vtype' order by id DESC LIMIT $start, $limit";
$result = mysql_query($query1);
// Initial page num setup
if ($page == 0){$page = 1;}
$prev = $page - 1;
$next = $page + 1;
$lastpage = ceil($total_pages/$limit);
$LastPagem1 = $lastpage - 1;
$paginate = '';
if($lastpage > 1)
{
The code below is where the error message is generating from.
while($row = mysql_fetch_array($result))
{