Jump to content

Get data PHP


Recommended Posts

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.

Link to post
Share on other sites

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

Link to post
Share on other sites
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.
Link to post
Share on other sites
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?
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...