...

View Full Version : Php columns



awire
03-23-2010, 07:27 AM
HELP!!! I am trying to have my data displayed in 4 colums wide on my page, can anyone help! Here is the code:

<?php

//connect include
require ("connect.php");

//extract data
$extract = mysql_query ("SELECT * FROM people ORDER BY id ASC");
$numrows = mysql_num_rows ($extract);

while ($row = mysql_fetch_assoc ($extract))
{

$id = $row['id'];
$firstname = $row['firstname'];
$lastname = $row['lastname'];
$dob = $row['dob'];
$gender = $row['gender'];

if ($gender=="F")
$gender = "Female";
else
$gender = "Male";


echo "$firstname $lastname<br> was born on $dob<br> and is $gender<br /><br />";


}


?>

avizhome
03-23-2010, 07:38 AM
the best way is to use tables:


while($row = mysql_fetch_array($result))
{

echo "<tr>";
echo "<td>" . $firstname. "</td>";
echo "<td>" . $lastname. "</td>";
echo "<td>" . "was born on". "</td>";
echo "<td>" . $dob. "</td>";
echo "<td>" . $gender. "</td>";
echo "</tr>";

}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum