vet911 Posted January 26, 2011 Share Posted January 26, 2011 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> Quote Link to comment https://forums.phpfreaks.com/topic/225796-i-need-some-help-with-a-couple-of-items-in-my-script/ Share on other sites More sharing options...
vet911 Posted January 27, 2011 Author Share Posted January 27, 2011 I got the email link to work. Any help on the columns? Below is what I used. echo "<tr><td><a href=\"mailto:{$row['email']}\">{$row['email']}</a></td></tr>"; Quote Link to comment https://forums.phpfreaks.com/topic/225796-i-need-some-help-with-a-couple-of-items-in-my-script/#findComment-1165754 Share on other sites More sharing options...
fenway Posted January 28, 2011 Share Posted January 28, 2011 What's wrong with them? Quote Link to comment https://forums.phpfreaks.com/topic/225796-i-need-some-help-with-a-couple-of-items-in-my-script/#findComment-1166353 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.