Hi folks, I have a normalized database which is based on a learning environment.
I would like to be able to search for a selection of keywords which are in a table called 'C_Search' and use them to pull up the course details which stored in 'C_Info'. I have a basic search function but it is driving me crazy with how to get the keywords involved as I am new to all this and trying to learn as I go along...sometimes we need help
The code I have so far is:
<?php
mysql_connect ("localhost", "jimbooth","test1") or die (mysql_error());
mysql_select_db ("jimbooth_database");
$term = $_POST['term'];
$term = $_POST['term'];
$sql = mysql_query("select * from C_Info where C_Description like '%$term%'");
if (mysql_num_rows($sql) <= 0) {
// no results
echo 'Sorry, No results found.';
} else
while ($row = mysql_fetch_array($sql)){
echo '<br/> Course Info: '.$row['C_Description'];
echo '<br/> Duration: '.$row['C_Duration'];
echo '<br/> Entry Requirements: '.$row['C_Entry_Req'];
echo '<br/> Course Cost: '.$row['C_Cost'];
echo '<br/> Course Progression: '.$row['C_Progression'];
echo '<br/><br/>';
}
?>
Could anyone shed any light on this for me and point me in the right direction please