I feel like I am missing something stupidly obvious here, I am trying to get the results of an SQL query and then using them in a loop. I feel like I am missing something st
You must first fetch your results into an array. Looks like you started to do this but commented it out.
$results = mysql_query($query);
//$userData = mysql_fetch_array($results, MYSQL_ASSOC);
$resultset = array();
while ($row = mysql_fetch_array($results)) {
$resultset[] = $row;
}
// $resultset now holds all rows from the first query.
foreach ($resultset as $result){
//... etc...