I am a pharmacist working on a project where a user can get medicines information from my database. I have made the search results page but I'm unable to make a details page. Here is my search.php page:
<?php
$db_hostname = 'localhost';
$db_username = 'root';
$db_password = '';
$db_database = 'drug';
// Database Connection String
$con = mysql_connect($db_hostname,$db_username,$db_password);
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db($db_database, $con);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<div>
<?php
if (!empty($_REQUEST['term'])) {
$term = mysql_real_escape_string($_REQUEST['term']);
$sql = "SELECT * FROM drugs WHERE GenericName LIKE '%".$term."%' OR BrandName LIKE '%".$term."%' OR Pharmacologicalclass LIKE '%".$term."%' OR ManufacturedBy LIKE '%".$term."%'";
$r_query = mysql_query($sql);
while ($row = mysql_fetch_array($r_query)){
echo '<a href="results.php?id='.$row['GenericName'].'"> <h4>'.$row['BrandName'].'</h4></a>';
echo '<br />Generic Name: ' .$row['GenericName'];
echo '<br /> Dosage Form: '.$row['Dosage form'];
echo '<br /> Pharmacological Class: '.$row['Pharmacologicalclass'];
echo '<br /> Indications: '.$row['Indications'];
echo '<br /> Manufactured By: '.$row['ManufacturedBy'];
}
}
?>
</div>
</body>
</html>
On the details page I want to include GenericName, BrandName, Dosageform, Strength, indications, interactions, side effect, pregnancy category, pharmacological class, mode of action and manufactured by (all are rows in by drugs table).