Pauls74462 0 Posted July 25, 2010 Report Share Posted July 25, 2010 Below is a PHP code I found to get data from MySQL and show db info on a web page. What I like to do is to make the email link where I can click on it and send an email. What I need to know is what php line needs to be edited and how do I add the "mailto:" to the email address.The code live working can be seen at: http://softsevenorg.com/MySQL/GetTables.php <html><head><title>MySQL Table Viewer</title></head><body><?php$db_host = 'localhost';$db_user = 'root';$db_pwd = 'lptm42b';$database = 'sphinx';$table = 'spheres';if (!mysql_connect($db_host, $db_user, $db_pwd)) die("Can't connect to database");if (!mysql_select_db($database)) die("Can't select database");// sending query$result = mysql_query("SELECT * FROM {$table}");if (!$result) { die("Query to show fields from table failed");}$fields_num = mysql_num_fields($result);echo "<h1>Table: {$table}</h1>";echo "<table border='1'><tr>";// printing table headersfor($i=0; $i<$fields_num; $i++){ $field = mysql_fetch_field($result); echo "<td>{$field->name}</td>";}echo "</tr>\n";// printing table rowswhile($row = mysql_fetch_row($result)){ echo "<tr>"; // $row is array... foreach( .. ) puts every element // of $row to $cell variable foreach($row as $cell) echo "<td>$cell</td>"; echo "</tr>\n";}mysql_free_result($result);?></body></html> PS. The MySQL connections info in the above file is NOT the current info. Quote Link to post Share on other sites
MrFish 9 Posted July 25, 2010 Report Share Posted July 25, 2010 You need to make a new page where there is an email form. Unless you want outlook, thunderbird, evolution mail, etc. to open when the click the link (which it already does), you will need to make an email form on your website.http://w3schools.com/php/php_mail.asp Quote Link to post Share on other sites
Pauls74462 0 Posted July 26, 2010 Author Report Share Posted July 26, 2010 You need to make a new page where there is an email form. Unless you want outlook, thunderbird, evolution mail, etc. to open when the click the link (which it already does), you will need to make an email form on your website.http://w3schools.com/php/php_mail.asp Clicking email does not work. Quote Link to post Share on other sites
thescientist 231 Posted July 26, 2010 Report Share Posted July 26, 2010 Clicking email does not work.what did you do? That's not a very helpful response. I guess the first thing is, is do you understand the differences between using PHP and a form versus using mailto? Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.