I have multiple SQL Queries with While loops in PHP for a search form.
There are 3 blocks of code in total, each selected from a different table and before the while loop i use
if(mysql_num_rows($rs) > 0) {
...show results here
}
I would like to have it so if there is only one result returned for the 3 blocks of code, it will automatically redirect to a different page.
For example, i am searching for Customers, Contacts and Invoices. So they are the 3 different blocks of code / queries i have.
If i search for Company A and there is 1 record returned in the customers query and 0 records returned in Contacts and Invoices, it should redirect to the customer page. However if there is 2 records returned it should just display the search results.
and the same for Customers, Contacts and Invoices