Results 1 to 2 of 2
Related
-
Almost Done, Need DIV expert for one thing Forum: Myspace Forum
Replies: 1 -
78 rpm records Forum: General Discussion
Replies: 2 -
Whats teh next best thing?? Forum: General Discussion
Replies: 1 -
Deleting records Forum: PHP Forum
Replies: 5
-
05-30-2003, 12:29 PM #1
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>
-
05-30-2003, 02:09 PM #2
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 theicon to add to their reputation!
No support via email or private message - use the forums!
Before you ask, have you Searched?
Cloudjiffy- PaaS for Developers
10-05-2020, 12:30 AM in Web Hosting Forum