Jump to content

Archived

This topic is now archived and is closed to further replies.

cdtc

If..Else Result

Recommended Posts

I am sure it is a simple answer, but in a IF..Else Statement how do I redirect to a one page if there is a result from my database or redirect to another if there is no result?

Share this post


Link to post
Share on other sites
if($result = 1)
{
header("location: http://gotopage.com");
}
else
{
header("location: http://gotopage2.com");
}

Share this post


Link to post
Share on other sites
yes, it might vary slightly depending on what you are retrieving from the database.

Share this post


Link to post
Share on other sites

$strSQL="SELECT * FROM School WHERE ([School Code Number] = '" .$_POST['schoolcode']."')";

Share this post


Link to post
Share on other sites
$strSQL="SELECT * FROM School WHERE ([School Code Number] = '" .$_POST['schoolcode']."')";
$strRows = mysql_num_rows($strSQL);

if ($strRows  > 0)
{
header("location: http://gotopage.com");
}
else
{
header("location: http://gotopage1.com");
}

i think

Share this post


Link to post
Share on other sites
Thats Great thanks!!

(look out for www.creaseyIT.co.uk launch date sept 1st)

Share this post


Link to post
Share on other sites

×

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.