Well....
I think it has something to do with the query - and php:
How are the values made global, sent into the function? To make them global is well and good, but how will the function get_ads_count() know those values prior to the global statement?
Maybe I'm far afield here but:
## Making the values available inside the function ##
function get_ads_count($cat_fields, $table_ads, $ct, $page,$adsonpage)
{
## What is this function? It is a part of the query, and may be the perpetrator. And it lacked a ; ##
$where_string=get_where_string() ;
## This query is dubious - either you must say "count (*) from table where" or "count(idnum) as max from table where"? And the query is a count ... ##
$sql_query="select count(*) from $table_ads where
$where_string ";
## This would do better without the " ##
$sql_res=mysql_query($sql_query);
## The result stored in $sql_res is a count (number), so you can't use the result to fetch the row below ##
//$row=mysql_fetch_row($sql_res); //Not possible
//$count=$row[0];
//return $count;
}
Without knowing the function get_where_string() it's difficult to say wether it plays a role in the error, but you should study the querys at:
http://www.php.net/manual/en/ref.mysql.php
knutm