View Single Post
Old 03-20-2007, 02:08 AM   #1 (permalink)
Salchester
Salchester
 
Salchester's Avatar
 
Join Date: Jul 2005
Location: In a house
Posts: 230
Salchester is an unknown quantity at this point
PHP Display Data

Hi Everyone, hows it going?

I'm currently using the following code, inoder to create a table like structure on a page:

.cell
{
left: 0px;
top: 0px;
width: 100px;
height: 100px;
position: relative;
margin-left: 10px;
margin-bottom: 10px;
float: left;
}

how do i display all the first names and last names, stored in the database, inside different boxes, like a table? See below

Code:
<?php
$con = mysql_connect("localhost","peter","abc123");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("my_db", $con);

$result = mysql_query("SELECT * FROM person");

while($row = mysql_fetch_array($result))
  {
  echo $row['FirstName'] . " " . $row['LastName'];
  echo "<br />";
  }

mysql_close($con);
?>
| FIRSTNAME | LASTNAME |
| Brian | Tims |
| Stuart | Holmes |

Many Thanks,
__________________
Many Thanks, in advance!

Salchester.
The Future Is Here - Are You Ready?
Salchester is offline   Reply With Quote