php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #21455 Displaying records from mysql in a tabular form
Submitted: 2003-01-06 02:30 UTC Modified: 2003-01-06 02:39 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: lerato101 at hotmail dot com Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 4.2.0 OS: windows 97
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: lerato101 at hotmail dot com
New email:
PHP Version: OS:

 

 [2003-01-06 02:30 UTC] lerato101 at hotmail dot com
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>
<?
}
?>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-01-06 02:40 UTC] georg@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Nov 16 19:01:30 2024 UTC