I have managed to display data from mysql db to a webpage, plus a hyperlink to the users email address if they entered it in the form. I want to be able not to show the link if a user does not fill in their email address. Please view my code below. At the moment thou, a hyperlink is still being shown, take a look at my code. Im still learning.
to put this in simpler terms,
if user has email address in dbase display the link on the webpage
else
do not display link
<?php
$connection = mysql_connect (\"server\",\"user\", \"pass\");
if ($connection == false){
echo mysql_errno().\": \".mysql_error().\"<BR>\";
exit;
}
$query = \"select * from greatbritain\";
$result = mysql_db_query (\"dbname\", $query);
if ($result){
echo \"<table border=0 width=100% cell>\";
$numOfRows = mysql_num_rows ($result);
for ($i = 0; $i < $numOfRows; $i++){
$country = mysql_result ($result, $i, \"country\");
$region = mysql_result ($result, $i, \"region\");
$descy = mysql_result ($result, $i, \"descy\");
$tel = mysql_result ($result, $i, \"tel\");
$email = mysql_result ($result, $i, \"email\");
echo \"<tr>$country</tr><tr>$region</tr><tr>$descy</tr><tr>$tel</tr><tr><a href=mailto:$email>email</a></tr><br>\";
}
echo \"</table>\";
}
else{
echo mysql_errno().\": \".mysql_error().\"<BR>\";
}
mysql_close ();
?>