Nope there are three
heres my call to my function:
$result = SELECT($items,$table_name,$where_condition,$group_by,$having,$order_by,$limit,$database_pcmedic,$pcmedic);
$rs = $result[0];
$query = $result[1];
$row = mysql_fetch_assoc($rs);
$totalrows = mysql_num_rows($rs);
my function:
//SELECT FUNCTION
function SELECT($items,$table_name,$where_condition,$group_by,$having,$order_by,$limit,$database_pcmedic,$pcmedic)
{
mysql_select_db($database_pcmedic, $pcmedic);
$query ="SELECT $items FROM $table_name";
if ($where_condition !== "")
{
$query .=" WHERE $where_condition";
}
if ($group_by !== "")
{
$query .=" GROUP BY $group_by";
}
if ($having !== "")
{
$query .=" HAVING $having";
}
if ($order_by !== "")
{
$query .=" ORDER BY $order_by";
}
if ($limit !== "")
{
$query .=" LIMIT $limit";
}
$rs = mysql_query($query, $pcmedic) or die(mysql_error());
$row = mysql_fetch_assoc($rs);
$totalRows = mysql_num_rows($rs);
return array($rs,$query);
}
$query output:
SELECT * FROM news_table WHERE newsactive=1 ORDER BY newsid DESC
$totalrows output:
3
before I had done:
do
{
looped code
}
while ($row = mysql_fetch_assoc($rs))
that gave me only two of my results...
when i do the way as aforementioned I get just one result, the one missing from the two
hope that helps