"...Remember being a youngster, mom or dad telling you "close the door"? Well the same applies to HTML ...."

Go Back   Webmaster Forums > Code Forum > PHP Forum

Reply
 
Thread Tools Rate this Webmaster Discussion
Old 05-30-2003, 12:29 PM   #1
minds_gifts
New Member
 
Join Date: Apr 2003
Webmaster Discussions: 15
Rep Power: 46
minds_gifts is on a distinguished road
Displaying records on a template like thing

Hi everybody,

I'm new to this board and of course to php, very first post here:
I'm trying to display the records from a table and i'm successful too.But, i dont want to display them in a table format - but in some pretty good way.
I've attached the attachment as an image like how i want to display.So, each record shld fit in a nice template like thing.How should i modify my code to show something like that, is it really hard??

Thanks one and all.

Also, I would like to show my code which i've so far:

PHP Code:

<html> 
<body> 
<?php 
// Lets create our MySQL connection 

    
// Lets select our database 

// Lets select our record fields from our database table and check for results 

    
$sql="SELECT  introtext,zipcode,image,telephone,email,description FROM tbl_personals ORDER BY id"

    
$mysql_result=mysql_query($sql,$connection); 
    
$num_rows=mysql_num_rows($mysql_result); 
    
// We have no results 

    
if ($num_rows == 0) { 
    echo 
"Sorry, we have no records"
    } else { 

// We have  results so create a table to display them 

echo "<TABLE ALIGN=\"CENTER\" BORDER=\"1\">"
//echo "<TR><TH>Var 1 values</TH><TH>Var 2 values</TH></TR>";    

// We carry out the table population using a 'while' loop 

while ($row=mysql_fetch_array($mysql_result)) 

$var_1=$row["introtext"]; 
$var_2=$row["zipcode"]; 
$var_3=$row["image"]; 
$var_4=$row["telephone"]; 
$var_5=$row["email"]; 
$var_6=$row["description"]; 
// We display the results under the correct headings 

echo "<TR><TD>$var_1</TD><TD>$var_2</TD><TD>$var_3</TD><TD>$var_4</TD><TD>$var_5</TD><TD>$var_6</TD></TR>"


// End else while 
}

//We close the MySQL connection 

mysql_close($connection); 

?> 

</TABLE> 
</body> 
</html>


minds_gifts is offline   Reply With Quote
Old 05-30-2003, 02:09 PM   #2
QuietDean
Administrator
 
QuietDean's Avatar
 
Join Date: Oct 2000
Location: Bournemouth, UK
Webmaster Discussions: 2,662
Rep Power: 98
QuietDean has a reputation beyond reputeQuietDean has a reputation beyond reputeQuietDean has a reputation beyond reputeQuietDean has a reputation beyond reputeQuietDean has a reputation beyond reputeQuietDean has a reputation beyond reputeQuietDean has a reputation beyond reputeQuietDean has a reputation beyond reputeQuietDean has a reputation beyond repute
Send a message via ICQ to QuietDean
Creating a proper template system is not 'hard' as such, but it is a lot of work. You will need a full tutorial, this one is good -

http://www.phpdeveloper.org/view_tut.php?id=50

Otherwise, you can continue what you are doing, layout your database results using HTML in the php code. However, you may want to think about exclusively using CSS for your styling and layout, that way you can let CSS be your template system..
__________________
If one of our members helps you, please click the icon to add to their reputation!
No support via email or private message - use the forums!
Before you ask, have you Searched?
QuietDean is offline   Reply With Quote
Reply

Bookmarks

Tags
displaying, records, template, thing

Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off


Similar Webmaster Discussions
Thread Webmaster Discussion Starter Forum Replies Last Post
inseting records to a database through html code... nawaray ASP Forum 24 10-26-2007 06:14 AM
78 rpm records HTML General Discussion 2 03-08-2007 03:31 PM
Script database 29,000 Records for sale zhisede Websites For Sale 1 02-20-2006 09:12 AM
Deleting records minds_gifts PHP Forum 5 04-22-2003 11:54 AM


All times are GMT -5. The time now is 10:03 PM.


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.