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? Quote 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");} Quote 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... Quote 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. Quote 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']."')"; Quote 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 Quote 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) Quote Link to comment https://forums.phpfreaks.com/topic/14575-ifelse-result/#findComment-57842 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.