Jump to content


Photo

Template layout


  • Please log in to reply
1 reply to this topic

#1 celestineweb

celestineweb
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 13 April 2006 - 01:55 PM

The script below calls other scripts to build the page.

<?
include '../ssi/top.php';
include '../ssi/left_nav.php';
include '../ssi/headline1.php';
include '../ssi/headline2.php';
include '../ssi/headline3.php';
include '../ssi/advert1.php';
include '../ssi/content.php';
include '../ssi/right_nav.php';
include '../ssi/footer.php';
?>

This is part of the content.php script:-

$query="SELECT * FROM users WHERE country='$country' ORDER BY last_name ASC";
$result=mysql_query($query);
$num=mysql_numrows($result);
//error checking country
if ($num<=0)
{
echo "we do not have anyone listed in this country yet
please press back button to make another selection";
exit;

}

If the 'if' statement is true the script exits and does not action :-

include '../ssi/right_nav.php';
include '../ssi/footer.php';

in the layout page.

Is there a way round this, I have tried including the above in the if statement and read throught the books but cannot find a solution. If I remove the exit statement the page loads ok but also shows results from the database that are not wanted.

#2 celestineweb

celestineweb
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 13 April 2006 - 02:09 PM

Ok I solved it:-

if ($num<=0)
{
echo "we do not have anyone listed in this town yet
please press back button to make another selection";
?>
</div>
<?
include '../ssi/right_nav.php';
include '../ssi/footer.php';
exit;
}

If anyone has a nicer way of doing this please let me know




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users