Solved

Database query - turn field to mailto

Posted on 2006-07-23
1
231 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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

730 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