Happy holidays all,
First of all here is a summary of my question, is there any such thing as mysqli_fetch_column
Ok here is my situation; I have a file that is in this format in both excel and in MySQL
Year Month Value
2009 Jan 265
2009 Feb 274
2009 March 526
2010 Jan 456
2010 Feb 454
2010 March 456
2010 April 123
And I want to convert it to this format for each value
Year Jan Feb March April May June
2009 212 265 169 196 296 226
2009 566 274 298 656 656 552
2009 663 526 255 256 225 225
2010 566 456 456 456 464 545
2010 566 454 123 123 465 454
2010 565 456 123 455 54 454
2010 463 123 123 46 545 454
Here is part of what I am experimenting with,
$result = $db->query($query);
$num_results = $result->num_rows;
echo "<table>";
echo "<tr>";
for ($i=0; $i <$num_results; $i++) {
$row = $result->fetch_assoc();
echo "<td>";
echo $row['month'];
echo "</td>";
}
echo "</tr>";
echo "</table>";
$result->free();
$db->close();
I should mention that I am just getting started with PHP/MySQL have just taken one semester class on the subject. Any feedback will be greatly appreciated.