cdtc Posted July 1, 2006 Share Posted July 1, 2006 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. Quote Link to comment https://forums.phpfreaks.com/topic/13373-result-return/ Share on other sites More sharing options...
redarrow Posted July 1, 2006 Share Posted July 1, 2006 if($whatever==$whatever) {header("location whatever.php");}elseif($whatever==$whatever) {header("location whatever.php");}else{header("location whatever.php");} Quote Link to comment https://forums.phpfreaks.com/topic/13373-result-return/#findComment-51630 Share on other sites More sharing options...
wildteen88 Posted July 1, 2006 Share Posted July 1, 2006 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] Quote Link to comment https://forums.phpfreaks.com/topic/13373-result-return/#findComment-51631 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.