Jump to content

Archived

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

cdtc

Result Return

Recommended Posts

I am looking for a IF statement that
if returns a result i want it to direct to a page. and tehn else if it does not it will direct to a different page.

Share this post


Link to post
Share on other sites

if($whatever==$whatever) {

header("location whatever.php");

}elseif($whatever==$whatever) {

header("location whatever.php");

}else{

header("location whatever.php");
}

Share this post


Link to post
Share on other sites
By result you mean a mysql query if so you do something like this:
[code=php:0]<?php

// connect to db

$query = "SELECT * FROM table_name WHERE condition=some_value")
$result = mysql_query($query);

if(mysql_num_rows($result) < '1')
{
    // the query returned no results
    header("Location: no-results.php");
}
else
{
    // the query return at least 1 or more results
    header("Location: results.php");
}

?>[/code]

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.