Basically, the search engine itself works but I have trouble in finding a way to get the script to know how many results have been returned. The idea is to have an if statement showing a disambiguation page if there're 2 or more results.
Here're the relevant portions of code.
function get_array($searchterm) { $do_query = mysql_query("select * from db where Name LIKE '%$searchterm%'");
$resultsarray = array();
while($item = mysql_fetch_array($do_query)){
array_push($resultsarray, $item);
} return $resultsarray; }
$s_results = get_array($_POST['textfield']);
for($int = 0; $int < count($s_results); $int++){
}
The last bit of code does actually output the code I want to (it fetches the results and displays them if I have the code to do that in the for loop) but I cannot find a way of finding out how many results I got - I'd've thought that just referring to $int would work, but $int is always NULL. I've tried a bunch of stuff with mysql_num_rows(); but everything I've tried with that either gives an error, nothing or an incorrect number (for instance, the number of fields in a row).
I'd very much appreciate any help on this, thanks 🙂