View Single Post
Old 03-21-2008, 11:15 AM   #2 (permalink)
freenity
The Acquainted
 
freenity's Avatar
 
Join Date: Feb 2008
Posts: 119
Thanks: 17
freenity is on a distinguished road
Default

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)
__________________
http://feudal-times.net - My PBB Game
http://gwphp.feudal-times.net - My Blog "Gaming With PHP"
freenity is offline  
Reply With Quote