Hi,
I have written a fairly simple search script for a website I am working on, the search box works great, it shows the results and if it cannot find the text that is entered it redirects to a page telling the user that it cannot find information.
Now im stuck with the code to write incase the user doesn't enter anything into the search box.
This is my code for the current redirect: -
<?
$database="database";
mysql_connect ("localhost", "user", "pass");
@mysql_select_db($database) or die( "Unable to select database");
$sql = "select emulator, version, os, platform, details from windows_atari2600 where emulator LIKE '%".mysql_real_escape_string($_POST["emusearch"])."%' OR platform LIKE '%".mysql_real_escape_string($_POST["emusearch"])."%' order by platform asc, emulator asc";
$result = mysql_query($sql);
$num_rows = mysql_num_rows($result);
if($num_rows < 1)
{
echo "<meta http-equiv='refresh' content='0; URL=/searchnoresults.php'>";
}
else
if(
{
include ('http://www.emulators.cc/includes/head.php');
?>
Im planning on putting the redirect code for when nothing is entered into the last 'If(' part.
Any help would be appreciated.
Thanks in advance. 🙂