From:             [EMAIL PROTECTED]
Operating system: windows 97
PHP version:      4.2.0
PHP Bug Type:     MySQL related
Bug description:  Displaying records from mysql in a tabular form

hi!

i'm a beginner in php and i've learned the below method of displaying
records from mysql.i have discoverd that this method wastes space.

could you please offer me any kind of help that will enable me to display
the records in a table depending on the items i enter on my form.i want
the names of the headings to be at the top,and then the records must
follow in the rows on a table.

your help will appreciated.

<?
$x = 0;
$query = "select * from details"; 
$result = mysql_query($query);
while($record = mysql_fetch_assoc($result)){
   while(list($fieldname,$fieldvalue) = each($record)){
   $x++;
?>

<table width="100%" border="0" cellspacing="0" >
<tr>

<td bgcolor="#FFFFCC" 
<? echo "<font color='#000000'face='Arial' size='2'>
<B>".$fieldname."</B></font>
<font color='#000000' face='Geneva, Arial, Helvetica, sans-serif' 
size='2' ><B>".": </B></font> ".$fieldvalue."<BR></font>";?></td></tr>

</table>

<? } ?>

<hr>
<?
}
?>
-- 
Edit bug report at http://bugs.php.net/?id=21455&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=21455&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=21455&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=21455&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=21455&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=21455&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=21455&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=21455&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=21455&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=21455&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=21455&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=21455&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=21455&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=21455&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=21455&r=gnused

Reply via email to