cdtc Posted July 14, 2006 Share Posted July 14, 2006 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? Link to comment https://forums.phpfreaks.com/topic/14575-ifelse-result/ Share on other sites More sharing options...
brown2005 Posted July 14, 2006 Share Posted July 14, 2006 if($result = 1){header("location: http://gotopage.com");}else{header("location: http://gotopage2.com");} Link to comment https://forums.phpfreaks.com/topic/14575-ifelse-result/#findComment-57835 Share on other sites More sharing options...
brown2005 Posted July 14, 2006 Share Posted July 14, 2006 using thatif use post your SELECT STATEMENT I CAN WRITE IT PROPER... Link to comment https://forums.phpfreaks.com/topic/14575-ifelse-result/#findComment-57836 Share on other sites More sharing options...
GingerRobot Posted July 14, 2006 Share Posted July 14, 2006 yes, it might vary slightly depending on what you are retrieving from the database. Link to comment https://forums.phpfreaks.com/topic/14575-ifelse-result/#findComment-57837 Share on other sites More sharing options...
cdtc Posted July 14, 2006 Author Share Posted July 14, 2006 $strSQL="SELECT * FROM School WHERE ([School Code Number] = '" .$_POST['schoolcode']."')"; Link to comment https://forums.phpfreaks.com/topic/14575-ifelse-result/#findComment-57838 Share on other sites More sharing options...
brown2005 Posted July 14, 2006 Share Posted July 14, 2006 $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 Link to comment https://forums.phpfreaks.com/topic/14575-ifelse-result/#findComment-57841 Share on other sites More sharing options...
cdtc Posted July 14, 2006 Author Share Posted July 14, 2006 Thats Great thanks!!(look out for www.creaseyIT.co.uk launch date sept 1st) Link to comment https://forums.phpfreaks.com/topic/14575-ifelse-result/#findComment-57842 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.