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. 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");} 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] Link to comment https://forums.phpfreaks.com/topic/13373-result-return/#findComment-51631 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.