Hello,
Do you know why this code ( in particular line: if ($row = mysql_fetch_array($result)) ) takes put a first row from the result?
$result = mysql_query($sql);
if ($row = mysql_fetch_array($result)) {
$cols = $_POST['column_name'];
for ($i=0; $i<sizeof($cols); $i++) {
$fh_name = $cols[$i];
$fheader_name = 'outputheader' . $fh_name;
$fheader_name ($row['record_id']);
}
while ($row = mysql_fetch_array($result)) {
for ($i=0; $i<sizeof($cols); $i++) {
$fl_name = $cols[$i];
$fn_name = 'output' . $fl_name;
$fn_name ($row['record_id']);
}
}
I echoed mysql_num_rows($result) before executing the code (4 rows), but output of last while loop gives only 3 sets of rows.
When I removed first line if ($row = mysql_fetch_array($result)), then output gives correct number of rows 4. However, in that case, $row['record_id'] is underfined inside first "for" loop.
Do you know how fix that and why line ($row = mysql_fetch_array($result)) takes out a first row of a result set?
Thank you,