My database displays names of people linked to tv programmes amongst other things.
Is there anyway I can get the database to show, all the programmes that a certain person is involved in. I.e all the programmes directed by Alan Smith.
I have tried this: (scroll down for more info after this code)
function show_people_director_progs($person) {
$query = "SELECT * FROM progs WHERE director = '$person'";
$result = mysql_query($query) or die ('Unable to show directors programmes.');
$num = mysql_num_rows($result);
if ($num != 0) {
while ( $rows = mysql_fetch_array($result) ) {
$prog_id = $rows['prog_id'];
$title = $rows['title'];
$first_shown = $rows['first_shown'];
echo ("$title - $first_shown - $prog_id<br>");
} // ends while loop
} else {
echo ("Hasn't directed anything");
}
} //ends function
The $person term that it refers is a link from another page. The problem I believe is that the $person is normally something like 'Alan Smith' i.e there is a space. So naturally the browser will display 'Alan%20Smith' so it distorts the results.
Is there anyway I can sort this??