[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 236
  • Last Modified:

Database query - turn field to mailto

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
bentbris
Asked:
bentbris
1 Solution
 
RWJDComCommented:
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now