Search page blank when no results from search field

0

I'm using the following code on my page to generate a search form that can be seen in action here: http://www.interviewhub.co.uk/search/

If I select somewhere from the dropdown menu and click search and no results come back then I get a message below the main search fields but if I type a random name into the text field and click search - the search criteria is then removed when it searches for results.

I'd really appreciate some help here.

<?php
// sanitize the search param from the URL
if (isset($_GET["search"])) {
    $result = addslashes($_GET["search"]); 
}
// invoke Pods with the chosen pod as the param
$Record = new Pod('interview');

// the param 'member_type' is a pick field that is part of the members Pod, you can add multiple picks as a comma-delimited list
// the param 'Search' just changes what the submit button says

echo $Record->getFilters('genre,location','SHOW RESULTS');

// 'name ASC' returns results in Ascending order -- alpha by name
// 10 is return 10 results on a page
// %$result% is the user input from the textfield (see the if statement above)
$Record->findRecords('t.last_name ASC', 5, "(t.name LIKE '%$result%') AND t.live = 1");

// display pagination for the results, if needed
echo $Record->getPagination(); 

if($Record->getTotalRows()<1){echo '<p>Sorry, we could not provide any names from your search.</p>';}

// uncomment the line below to echo the sql statement generated by findRecords() -- invaluable for troubleshooting 
// echo $Record->sql;

// obviously, a template named member_list needs to exist.
echo $Record->showTemplate('interview_list_expanded');
echo $Record->getPagination(); 

?>

asked Jul 19 '10 at 2:46

daretothink

11

edited Jul 20 '10 at 6:39

add comment
enter at least 15 characters

2 Answers

0

Anyone?

answered Jul 27 '10 at 9:28

daretothink

11

add comment
enter at least 15 characters
0

That is strange, have you tried testing with PHP errors on? I ask because it seems to me that your filters should show up in either case, but they don't with the random search string. So is there some error that's preventing it from working?

answered Jul 28 '10 at 10:24

jackson

33

add comment
enter at least 15 characters