jamied66
02-19-2008, 04:48 PM
I've got a pretty complex page that constructs a query ($query) from a number of variables controlled by the user in checkboxes and such.
So depending on user input, the query i'm looking at could be between 1 and 15 columns wide with varying column names.
I'm able to get the header row out and it works fine using the code below.
$result = mysql_query($query) or die (mysql_error());
$zlinky_total=count($_POST['zlinky']); //how many rows are we asking from zlinky?
$avaya_total=count($_POST['avaya']); //how many rows are we asking from avaya?
$total_rows=$zlinky_total + $avaya_total - 1; //total number of rows being asked for.
echo "
<fieldset>
<legend>$save_name"; if ($save != 1) {echo " (not saved)";} echo "</legend>";
echo "
<table width=90% align=center >
<tr class=headrow >
";
$rows =0;
while ($rows <= $total_rows) {
echo "<td>";
$row_name=mysql_field_name($result, $rows);
echo $row_name;
echo"</td>";
$rows = $rows + 1;
}
echo "</tr>";
I'm stuck on some way to echo out the actual data from the query. Has any body been down this road before that can give me an idea as to some way to configure an array to give me the actual data from the query that I'm running?
Thanks.
So depending on user input, the query i'm looking at could be between 1 and 15 columns wide with varying column names.
I'm able to get the header row out and it works fine using the code below.
$result = mysql_query($query) or die (mysql_error());
$zlinky_total=count($_POST['zlinky']); //how many rows are we asking from zlinky?
$avaya_total=count($_POST['avaya']); //how many rows are we asking from avaya?
$total_rows=$zlinky_total + $avaya_total - 1; //total number of rows being asked for.
echo "
<fieldset>
<legend>$save_name"; if ($save != 1) {echo " (not saved)";} echo "</legend>";
echo "
<table width=90% align=center >
<tr class=headrow >
";
$rows =0;
while ($rows <= $total_rows) {
echo "<td>";
$row_name=mysql_field_name($result, $rows);
echo $row_name;
echo"</td>";
$rows = $rows + 1;
}
echo "</tr>";
I'm stuck on some way to echo out the actual data from the query. Has any body been down this road before that can give me an idea as to some way to configure an array to give me the actual data from the query that I'm running?
Thanks.