Hey guys, I have this code
$rowsy = mysql_query ( " SELECT * FROM mainpage WHERE page = 'Random'" );
$IDS = array ("17");
while ($rows = mysql_fetch_assoc($rowsy)) {
$IDS[] = $rows['ID'] ;
}
$numRows = mysql_num_rows($rowsy);
$real = $numRows - 1;
$random = rand(0,$rea);
$final = $IDS[$random];
$query17 = mysql_query( " SELECT * FROM mainpage WHERE ID = '$final'" );
Which should…
Find the amount of rows in the table with the page set as ‘Random’
Which it does
Then it should create an array with those ID’s.
Then it should find the rows again, this time subtracting one to correspond to the array
Then, find a random number between zero and the amount of rows, which I’m not really sure if it does
Then it should take that number and use it to pull an ID out of the array, which I’m pretty sure it doesn’t do.
Finally, it should pull use that ID to pull out the info from the array.
Not working.
Any brilliant ideas, I’m getting frustrated here.
Yeah, I realize this is a really stupid way to do this, but it’s about my only option with the way I set up the table like a moron.