Jump to content

Recommended Posts

Hi guys, 

 

I have this script I am running, http://pastebin.com/NR1A03hY,  works perfectly and does everything I need it to do.

 

The only thing is the redirect at the bottom of the script does not work if line 40 is true.

 

I think I have a problem with my foreach loop and the if statements in-between.

 

Please can someone check, I have no idea on this one! 

 

Edit: in the pastebin the redirect is striked out as i was problem solving it. Of course i would not strike it out once its back working!

 

Thanks

Edited by unistake
Link to comment
https://forums.phpfreaks.com/topic/300357-foreach-breakout/
Share on other sites

If this was written all the processing code up top and display output all below could have used header() prior to any output.

 

You can add a meta refresh in the place you have header() commented out.

echo "<meta http-equiv='refresh' content='5;URL='members_roster.php' />";
Edited by QuickOldCar
Link to comment
https://forums.phpfreaks.com/topic/300357-foreach-breakout/#findComment-1529714
Share on other sites

OK, so that covers "what should happen", what I'm asking is "what is actually happening"? Are there any error messages? does it redirect to the wrong location? does it give an empty output? have you got error checking and display errors at full and turned on? At what point does it break down? are the DB queries firing ok? 

 

The more verbose you can be with the problem the quicker we can help you find a solution. :)

Link to comment
https://forums.phpfreaks.com/topic/300357-foreach-breakout/#findComment-1529723
Share on other sites

Ok, at the moment it is just displaying a blank white page and no redirect is happening. 

 

The queries fire absolutely fine from what i can see in my database.

 

The code seems to break down at the end of the  code on line 84. 

 

If the code satisfies the if statement on line 91 the code runs and redirects exactly as it should finishing with the exit on line 128.

Link to comment
https://forums.phpfreaks.com/topic/300357-foreach-breakout/#findComment-1529725
Share on other sites

Alright and where are we with display errors and error reporting?  If you're using a hosting provider they commonly have error logging done to a file rather than the screen, which makes sense for public facing websites, but isn't as handy for development work

Link to comment
https://forums.phpfreaks.com/topic/300357-foreach-breakout/#findComment-1529727
Share on other sites

Did you add the echo after you found that the header call wasn't working or was it always there?

 

	
	echo 'Your roster has been updated! <a href="members_roster.php">Click here</a> to return to your roster.';
	
	
	//header("Location: members_roster.php");
	
	
	exit();
	

Link to comment
https://forums.phpfreaks.com/topic/300357-foreach-breakout/#findComment-1529729
Share on other sites

just to be clear, you are stating that with the echo 'Your roster has been updated ...'; statement in the code and the header() statement commented out, and you are sure the code you are showing us is is the correct and complete code that's being ran on the server, and the rank/crew type is not "Captain" and is not "First Officer", that all you get is a blank page?

 

if so, what does the 'view source' of that blank page in your browser show?

 

also, is there any chance that the blank page you end up on is frontend_login.php or some other page than the one you are showing us the code for?

 

what is the $_SESSION['Code'] value for this case where it isn't working?

 

if is seems like i/we are being skeptical, it's because the symptom you are stating is impossible for the posted code. so, either the code being posted isn't what is being ran or the symptom being reported isn't correct.

 

there's actually a ton of stuff this code is doing that isn't needed and can be greatly simplified, but having nothing to do with the current problem.

Edited by mac_gyver
Link to comment
https://forums.phpfreaks.com/topic/300357-foreach-breakout/#findComment-1529751
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.