It basically grabs the results of a MySQL querys from 3 different columns in a table and output them to an array, which works fine. The part that's playing up is echoing out the results of a flipped array once it had been flipped further down. PHP is reporting that there's an unexpected ";" on line 31, which is the 2nd while loop. Can anybody see why?
Code: Select all
mysql_connect("x", "x", "x");
mysql_select_db("people");
$q = mysql_query("SELECT * from counter");
$i = 0;
while ($row = mysql_fetch_array($q)) {
$counter[$i] = $row['counter'];
$ip[$i] = $row['ip'];
$date[$i] = $row['date'];
echo "$counter[$i] <br>";
echo "$ip[$i] <br>";
echo "$date[$i] <br>";
}
$flipCounter = array_flip($counter);
$flipIp = array_flip($ip);
$flipDate = array_flip($date);
$k = count($counter);
echo "<br><br><b><br>";
while ($j = 0; $j < $k; $j++) { //Line 31 //
echo "$flipCounter[$j]";
echo "$flipIp[$j]";
echo "$flipDate[$j]";
}