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

<?php
$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'";}?>>
<td>
<?php echo $result_ar['name']; ?></td>
<td>
<?php echo $result_ar['email']; ?>
</td>
<td>
<?php echo $result_ar['website']; ?>
</td>
</tr>
<?php
$i+=1;
}
?>

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.

Albert


More information about the thelist mailing list