Jump to content

Template layout


celestineweb

Recommended Posts

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.
Link to comment
Share on other sites

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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.