Deanznet Posted April 13, 2009 Share Posted April 13, 2009 I just need it a simple php/mysql code that i can put at the top of the page.. It has to be like It has to check if uStreet ,uApt ,uCity ,uState ,uZip are empty in the mysql database and if it is it redirect to info.php but if not it continues with the script.. Can anyone help? Quote Link to comment https://forums.phpfreaks.com/topic/153816-can-someone-help-me-with-a-redirect/ Share on other sites More sharing options...
trq Posted April 13, 2009 Share Posted April 13, 2009 Can anyone help? If you post your problematic code and a description of your problem, yes. Quote Link to comment https://forums.phpfreaks.com/topic/153816-can-someone-help-me-with-a-redirect/#findComment-808385 Share on other sites More sharing options...
Ashoar Posted April 13, 2009 Share Posted April 13, 2009 Well considering we can't see the code it is hard to help. But after you check the data you can add: header("Location: info.php"); You can add an else statement aftwards if you want it to do something else if their is information. Quote Link to comment https://forums.phpfreaks.com/topic/153816-can-someone-help-me-with-a-redirect/#findComment-808387 Share on other sites More sharing options...
Deanznet Posted April 13, 2009 Author Share Posted April 13, 2009 Okay.. I need a way to check if these tables are not empty in the mysql database. uStreet ,uApt ,uCity ,uState ,uZip If they are then the user gets redirect to info.php But if they are not empty then they dont get redirected and the script can finished. So something like select from blah blah if empty redirect }else{ script finishes. Quote Link to comment https://forums.phpfreaks.com/topic/153816-can-someone-help-me-with-a-redirect/#findComment-808395 Share on other sites More sharing options...
trq Posted April 13, 2009 Share Posted April 13, 2009 Were not here to write code for you. Quote Link to comment https://forums.phpfreaks.com/topic/153816-can-someone-help-me-with-a-redirect/#findComment-808397 Share on other sites More sharing options...
Deanznet Posted April 13, 2009 Author Share Posted April 13, 2009 Well.. If you want to take a look at my code then be my guess. I still don't understand how i can just check those 5 columns. <?php $query = "SELECT count(*) FROM pbs_users WHERE uEmail='".$userInfo[$TbUsers->col_uEmail]."'"); $result = mysql_query($query) or die(mysql_error()); if(empty){ header("Location: info.php"); } }else{ header("Location: index.php"); } Quote Link to comment https://forums.phpfreaks.com/topic/153816-can-someone-help-me-with-a-redirect/#findComment-808402 Share on other sites More sharing options...
Ashoar Posted April 13, 2009 Share Posted April 13, 2009 Well instead of slecting everything by using (*) add just the row names you need. COUNT rowname,rowname,rowname etc. Also you should change the way you are checking if they are empty. $query = "SELECT count(*) FROM pbs_users WHERE uEmail='".$userInfo[$TbUsers->col_uEmail]."'"); $result = mysql_query($query) or die(mysql_error()); if(mysql_num_rows($result)==0) ; header("Location: info.php"); } }else{ header("Location: index.php"); } Quote Link to comment https://forums.phpfreaks.com/topic/153816-can-someone-help-me-with-a-redirect/#findComment-808423 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.