03-21-2008, 11:15 AM
|
#2 (permalink)
|
|
The Acquainted
Join Date: Feb 2008
Posts: 119
Thanks: 17
|
I think this should work:
PHP Code:
function maketable($field, $query) {
$fields[] = array($field);
print("<table cellspacing=\"0\" cellpaddign=\"5\" width=\"100%\">\n");
$arr = mysql_query($query) or die(mysql_error()); while($fetch = mysql_fetch_array($arr)) { echo "<tr>\n"; foreach($fields as $f) { print("<td>".$fetch[$f]."</td>\n"); } echo "</tr>"; } print("</table>\n\n"); }
Also, unless you send an array of array to $field, you can't have indices on $f, when you do foreach($fields as $f)
|
|
|
|