I'm trying to run a while loop for each row returned from my query, and at the same time print an array of all the vertical columns values? Here is my code so far, although I'm not sure how to achieve the array.
The thing is I dont want the array of each column value inside the while loop. Basically Im trying to display a html table row of each database row values. So I already have the values displaying in the rows from the while loop, but how to access the vertical column of data and show that as an array in my code to create a graph.
Comments in the code also..
<?php
mysql_select_db("db_name", $con);
$qry = "SELECT * FROM tbl_name WHERE col_name='$col_name'";
$result = mysql_query($qry);
if (!$result) exit("The query didnt succeded");
else {
<!-- my while loop using each individual row from the database -->
while ($row = mysql_fetch_array($result)) {
$col1 = $row['col-name1'];
$col2 = $row['col-name2'];
$col3 = $row['col-name3'];
$col4 = $row['col-name4'];
$col5 = $row['col-name5'];
include 'file_to_be_looped.php';
?>
<br/>
<br/>
<?php
}
}
?>
<!-- then just get a list of all values from a single column of the same query-->
<?php echo $col1 ?> <!--this echo produces the last value in the array, so I think im close-->