Jump to content

I need some help with a couple of items in my script.


Recommended Posts

I have a database of members showing name, address, city, state, zip, phone and email address. I want to make the email address a link in my table on the webpage, and I would like to make 3 columns instead of one that  happens now. Any help would be appreciated, thanks in advance.

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<title></title>
<head>

<link rel="stylesheet" href="./stylesheet/stylesheet1.css" media="screen">
<style type="text/css" media="screen">@import url("./stylesheet/stylesheet2.css");</style>

</head>
<body>

<?php

// Make a MySQL Connection

$con = mysql_connect(localhost, root, 1910) or die ('Error connecting to mysql');
mysql_select_db("cmc_member") or die(mysql_error());

echo "Connected to Database <br>";

// Retrieve all the data from the "members" table
$result = mysql_query("SELECT * FROM members ORDER BY lname") or die(mysql_error());

// store the record of the "cmc_member" table into $row
$current = '';

// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
$id = $row['id'];
if (!$current) {
echo "<center><br><div><table border='0' width='250'>";
$current = $id;
} elseif ($current != $id){
echo "</table></div><br><br><div><table border='0' width='250'>";
$current = $id;
}
// Print out the contents of each row into a table


echo "<tr><td>{$row['fname']} {$row['lname']}</td></tr>";

echo "<tr><td>{$row['address']}</td></tr>";
echo "<tr><td>{$row['city']} {$row['state']} {$row['zip']}</td></tr>";

echo "<tr><td>{$row['phone']}</td></tr></div>";
echo "<tr><td>{$row['email']}</td></tr>";

}
echo "</table></div></center>";

?>

</body>
</html>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.