I am trying to retrieve data that is collected in a function, that contains my query. I am returning the data back to the main page and printing it using a while loop however i am getting this error:
Warning: mysql_fetch_assoc() expects parameter 1 to be resource, string given
Below is my code:
Main page:
<?php
$get5star = get5star();
while($row = mysql_fetch_assoc($get5star)){
echo $row['departmentid'] ;
}
?>
function:
function get5star(){
$strSQL = "SELECT * FROM `5starproducts`";
$query = mysql_query($strSQL);
return mysql_result($query, 0);
}
mysql_*API ;)