I have created a page to retrieve data from a database
I have created a database "orders" in Mysql and have a table named "spaces" in that.
Now the data is being retrieved successfully.
I would like use the data in a feedback form and it should be sent to the e-mail address specified in the feedback form i.e. I should get the name of the package etc. in the e-mail after the user orders a product from our site.
<?php
$db = mysql_connect("localhost", "root");
mysql_select_db("orders",$db);
// display individual record
if (!empty($_GET['id']) && is_numeric($_GET['id'])) {
$sql = "SELECT package, amount, currency, duration FROM spaces WHERE id=".$_GET['id'];
$result = mysql_query($sql, $db) or die(mysql_error().'<p>'.$sql.'</p>');
if (mysql_num_rows($result) == 1) {
$myrow = mysql_fetch_assoc($result);
echo 'Package Name: '.$myrow['package'].'<br />';
echo 'Amount: '.$myrow['currency'].'';
echo ' '.$myrow['amount'].'<br />';
echo 'Duration: '.$myrow['duration'].'<br />';
} else {
// no records found
echo 'There is no record with an ID of '.$_GET['id'];
}
} else {
// no records to display
echo 'Sorry, no records were found!';
}
?>