Solved

Database query - turn field to mailto

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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
echo button 13 47
WooCommerce Sort by Date 4 10
Creating a slider 12 34
Datepicker in PHP 9 14
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
This article discusses four methods for overlaying images in a container on a web page
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
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 …

757 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now