Jump to content

[SOLVED] I am new to php and msyql and am haiving a problem


vetman

Recommended Posts

I am new to php and msyql and am having a problem with making an email address in a table a link so I can send email. I can

get the information from the database but when I try to make the email address a link it won't work.

Any help would be appreciated!

Thanks in advance.

 

Here is my code:

<?php

// Make a MySQL Connection
include 'config.php';
//include 'style_1.php';

$con = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
mysql_select_db("vetmanpc") or die(mysql_error());

$result = mysql_query("SELECT * FROM lakestmill") or die(mysql_error());

// store the record of the "lakestmill" 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 "<div><table border='1' width='300'>";
$current = $id;
} elseif ($current != $id){
echo "</table></div><br><br><div><table border='1' width='300'>";
$current = $id;
}
// Print out the contents of each row into a table
echo "<tr><th width='80' height='3'> Unit No.</th><td>{$row['unit']}</td></tr>";
echo "<tr><th height='3'> Company</th><td>{$row['company']}</td></tr>";
echo "<tr><th height='3'> FirstName</th><td>{$row['firstname']}</td></tr>";
echo "<tr><th height='3'> LastName</th><td>{$row['lastname']}</td></tr>";
echo "<tr><th height='3'> Email</th><td><a href="{$row['email']}"</a></td></tr>";  
echo "<tr><th height='3'> Address</th><td>{$row['address']}</td></tr>";
echo "<tr><th height='3'> City</th><td>{$row['city']}</td></tr>";
echo "<tr><th height='3'> State</th><td>{$row['state']}</td></tr>";
echo "<tr><th height='3'> Zip Code</th><td>{$row['zip']}</td></tr>";
echo "<tr><th height='3'> Phone</th><td>{$row['phone']}</td></tr></div>";


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

?>

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.