[thelist] Displaying MySQL Records Using PHP

Albert Shala albert.shala at gmail.com
Thu Jan 27 16:02:00 CST 2005

Here's the code:

$connection = mysql_connect("localhost", "e_novative", "e_novative")
or die("Error connecting to database");
mysql_select_db("members", $connection);

$result = mysql_query("SELECT * FROM members ORDER BY id",
$connection) or die("error querying database");
$i = 0;
while($result_ar = mysql_fetch_assoc($result)){
<tr <?php if($i%2 == 1){ echo "class='body2'"; }else{echo "class='body1'";}?>>
<?php echo $result_ar['name']; ?></td>
<?php echo $result_ar['email']; ?>
<?php echo $result_ar['website']; ?>

Now the "website" part of my database contains actuall links, and i
want to have a loop that displays all these links, and of course each
link is different and the links will be different of course, to
external and internal sites.

Thank You.


More information about the thelist mailing list