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:
<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>