Hello Everyone
Im new to this forum just signed up in last couple minutes
reason is i have problem with some PHP code im working on
At present i have a search form which works for searching programme title
but i need it to work for all or either of the text fields
eg. there is 3 fields Programme_title, Programme_type and Programme_mode
the user may not know all of the fields so needs to be able to search via say title and mode or title, mode and type or just type or just mode etc
basically all ways apart from a blank value
The code i have been working on is given below:
==========================================================
<?php
$db = mysql_connect("database","username","password");
mysql_select_db("username",$db);
if ($prog_title) {
$result = mysql_query("SELECT * FROM programme WHERE ",$db);
{
if (prog_title <> "") THEN
mysql_query = (mysql_query . "prog_title= '"$prog_title"'");
}
if (!$rec = mysql_fetch_array($result)) {
echo ("Sorry, no records found");
}
else {
do {
echo("Programme Title:" . $rec["prog_title"] . "<br>\n");
echo("Programme UCAS: " . $rec["prog_ucas"] . "<br>\n");
echo("Programme Type: " . $rec["prog_type"] . "<br><br>\n");
}
While ($rec = mysql_fetch_array($result));
}
}
?>
Ive been told that i need to use if, if else statements after the SQL query
which i have started doing but dont understand really how to get it working!
Im hoping someone may me kind enough to pass some advice / help my way it will be greatly appriecated
I dont know if the form is needed to correctly understand my code, but if is please post and i will put the form code on
thanks for any help / advice in advanced greatly appriecated as mentioned
snoopgreen