I sorta have a problem. Now why I say sorta is cause the function I made does what I want it to and works fine only at the end it throws an error.
Code:
<?
include('../connection.php');
function featuredHomes()
{
$table = "story_tbl";
$high_array = array();
$q = "SELECT * FROM $table where id <= 4";
$r = mysql_query($q) or die("Error: " . mysql_error());
while($row = mysql_fetch_array($r))
{
array_push($high_array,$row['id']);
}
srand((double)microtime() * 1000000);
shuffle($high_array);
for($i=0;$i <= count($high_array);$i++)
{
$q2 = "SELECT head FROM $table WHERE id = $high_array[$i]";
$r2 = mysql_query($q2);
//-The line below is line 26, where the error claims to be.
$rows = mysql_fetch_array($r2);
$head = $rows['head'];
echo "<a href=\"fullstory.php?id=". $high_array[$i] . " \" target=\"blank\">". $head ."</a>";
echo "<BR>";
}
}
?>
Error Reads:
Warning: Supplied argument is not a
valid MySQL result resource in
home/dlonline/public_html/testing/testing.php on line 26