Database Forum
Web Database Register Members List Calendar FAQ

 
Go Back   Database Forum > Database Management > Cool Tips
User Name
Password

Reply
 
Thread Tools Search this Thread Display Modes
Default Display records in a table with a vertical format
05-19-2011, 07:13 AM #1  

johngay
Member

 
Status: Offline
Posts: 35
Join Date: Dec 2006
Location: Vancouver, WA

Thanks everyone for giving the examples of how to Insert field data into existing web page and how to display records in a table with a vertical format I tried to place the table_view.php file with an iframe in the document but it became too bulky.

I tweaked the code a little for the vertical format (thank you SusanH) and it seems to work great. Now I only show the data(s) I want to show I would still like to be able to sort the resulting data but I haven't figured that one out yet. I put it in an iframe and displayed in in an HTML page.

I placed an iframe calling the code and it displays selected parts of the HS alumni data across in a table with the data in a vertical format.

You can see an example at http://mooresvillealumni.com/fetch.htm
HTML Code:
<html> 
<head> 
<title>Results</title> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head> 
<body> 
<?php 
$database="johngay_mooresvilledata"; 
mysql_connect ("localhost", "username", "passwd"); 
@mysql_select_db($database) or die( "Unable to select database"); 
$query = "select * from personinfo"; 
$result = mysql_query($query); 
$num_results = mysql_num_rows($result); 
for ($i=0; $i <$num_results; $i++)  
?>
<table width="787" border="0">
  <tr>
    <td colspan="5"><?php echo "<p>Number matches found: ".$num_results."</p>";  
?></td>
  </tr>
  <tr>
    <td width="80" align="left"><strong>CLASS</strong></td>
    <td width="166" align="left"><strong>FIRST NAME</strong></td>
    <td width="166" align="left"><strong>LAST NAME</strong></td>
    <td width="166" align="left"><strong>Maiden Name</strong></td>
    <td width="286" align="left"><strong>E-Mail</strong></td>
  </tr>
  <tr>
    <td><?php 
$query = "select * from personinfo"; 
$result = mysql_query($query); 
$num_results = mysql_num_rows($result); 
for ($i=0; $i <$num_results; $i++) 
{  
$row = mysql_fetch_array($result); 
echo stripslashes($row["Date_Graduated"]); 
echo "<br>"; 
}  
?></td>
    <td><?php 
$query = "select * from personinfo"; 
$result = mysql_query($query); 
$num_results = mysql_num_rows($result); 
for ($i=0; $i <$num_results; $i++) 
{  
$row = mysql_fetch_array($result); 
echo stripslashes($row["FirstName"]); 
echo "<br>"; 
}  

?></td>
    <td><?php  
$query = "select * from personinfo"; 
$result = mysql_query($query); 
$num_results = mysql_num_rows($result); 
for ($i=0; $i <$num_results; $i++)
{ 
  
$row = mysql_fetch_array($result); 
echo stripslashes($row["LastName"]); 
echo "<br>"; 
} 
?></td>
    <td>
	<?php  
$query = "select * from personinfo"; 
$result = mysql_query($query); 
$num_results = mysql_num_rows($result); 
for ($i=0; $i <$num_results; $i++) 
{  
$row = mysql_fetch_array($result); 
echo stripslashes($row["MaidenName"]); 
echo "<br>"; 
} 
?>
</td>
    <td>
	<?php  
$query = "select * from personinfo"; 
$result = mysql_query($query); 
$num_results = mysql_num_rows($result); 
for ($i=0; $i <$num_results; $i++)  
{ 
$row = mysql_fetch_array($result); 
echo stripslashes($row["Email"]);  
echo "<br>"; 
} 
?></td>
  </tr>
</table>

</body> 
</html> 

Last edited by Jenn; 05-19-2011 at 11:32 AM.. Reason: removed login info
Reply With Quote

Default
07-23-2011, 01:42 AM #2  

John009
Guest

 
Status:
Posts: n/a

What a nice query to submit to display records in a table with vertical format. I think it is so easy and possible to display record through this coding. This coding is really complete and comprehensive to display the record in a table with vertical format

Cheap Viagra - Generic viagra

Last edited by John009; 07-25-2011 at 08:45 AM..
Reply With Quote

Default really
12-01-2012, 05:20 PM #3  

Rickysss
Junior Member

 
Status: Offline
Posts: 1
Join Date: Dec 2012

Hey guy I donīt know maybe m,uch about code, but the one thing I know is that you need to be very organized in order to archieve good results.
perforaciones diamantinas
Reply With Quote

Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump



All times are GMT -5. The time now is 05:17 AM.

Powered by: vBulletin Version 3.7.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Database Forums

Help support our forum assistants and product development ->

go to top go to top