Solved

Database query - turn field to mailto

Posted on 2006-07-23
1
232 Views
Last Modified: 2008-03-06
Ok - first thing - I know nothing about PHP what so ever.

I have a mysql db which this script is quering and it works.

However, i would like to make the Emails field a mailto and if possible set the subject of that email.

Any help would be greatly appreciated.

(this code came from a tutorial so if im doing anything wrong please let me know)

Thanks in advance

Paul





<html>
<body>
<?php

$db = mysql_connect("localhost", "users");

mysql_select_db("bentleys",$db);

$result = mysql_query("SELECT * FROM Awareness",$db);

if ($myrow = mysql_fetch_array($result)) {

  echo "<table border=1>\n";

  echo "<tr><td>Full Name</td><td>Status</td><td>Description</td><td>Email Address</td></tr>\n";

  do {

          printf("<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</a></tr>\n", $myrow["Fullname"], $myrow["Status"], $myrow["Description"],$myrow["Emails"]);

  } while ($myrow = mysql_fetch_array($result));

      echo "</table>\n";

} else {

      echo "Sorry, no records were found!";      

}

?>

</body>

</html>












</body>



</html>


0
Comment
Question by:bentbris
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 8

Accepted Solution

by:
RWJDCom earned 125 total points
ID: 17165177
Just change ...

printf("<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</a></tr>\n", $myrow["Fullname"], $myrow["Status"], $myrow["Description"],$myrow["Emails"]);

to

echo "<tr><td>" . $myrow['Fullname'] . "</td><td>" . $myrow['Status'] . "</td><td>" . $myrow['Description'] . "</td><td><a href=\"mailto:" . $myrow['Emails'] . "?subject=test subject\">" . $myrow['Emails'] . "</tr>\n";

That should work for you.
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question