M.O.S. Studios Posted July 7, 2010 Share Posted July 7, 2010 anyway to track a var value as it goes threw a script? my values are being deleted befor the end, i want to know if there is a way to track it? Quote Link to comment https://forums.phpfreaks.com/topic/207045-tracking-a-var/ Share on other sites More sharing options...
gwolgamott Posted July 7, 2010 Share Posted July 7, 2010 where do you want the variable to go? You could visually track it by just echoing... or create an array and just use the array push function to add a variable at different events and print all the values to see the progress of the variable. $bob = array(); $bob[0] = $my_var; //then later on inside of script just do this. array_push($bob,$my_var); // will add $my_var at this point to next avaible element... so first time around this will add to $bob[1]... and so on and so forth. Quote Link to comment https://forums.phpfreaks.com/topic/207045-tracking-a-var/#findComment-1082626 Share on other sites More sharing options...
M.O.S. Studios Posted July 7, 2010 Author Share Posted July 7, 2010 basically i have an array saved in session data that is being deleted some where in my cms. I'm trying to track down where its happening. Quote Link to comment https://forums.phpfreaks.com/topic/207045-tracking-a-var/#findComment-1082642 Share on other sites More sharing options...
gwolgamott Posted July 7, 2010 Share Posted July 7, 2010 Oh in session... hmmm. Best thing on that, that I can think of is at begin of every area that uses the session try printing the array content... Pain staking... but I don't know of any other way in that case. Maybe bumping this thread with this reply might get a response from someone who knows more. could do a search for unset or the variable itself in the scripts that are using it... maybe being overwritten with a null value or reset somewhere along the lines perhaps. About slightly just a hair less time consuming then printing it... Quote Link to comment https://forums.phpfreaks.com/topic/207045-tracking-a-var/#findComment-1082657 Share on other sites More sharing options...
M.O.S. Studios Posted July 7, 2010 Author Share Posted July 7, 2010 Never bumped a topic before. i did print_r($_SESSION); at the last line of the project, and all my values are there. but for some reason i am unable to pull the data up on anther page using session_id. the only thing i can figure is the values are being deleted Quote Link to comment https://forums.phpfreaks.com/topic/207045-tracking-a-var/#findComment-1082660 Share on other sites More sharing options...
kenrbnsn Posted July 7, 2010 Share Posted July 7, 2010 Do you do a "session_start()" on the other page? Ken Quote Link to comment https://forums.phpfreaks.com/topic/207045-tracking-a-var/#findComment-1082664 Share on other sites More sharing options...
PFMaBiSmAd Posted July 7, 2010 Share Posted July 7, 2010 The fact that you started a new thread for this problem when you already have a thread, means that you lost all the information you already posted, such as the code you have tried, where this works and does not, and that it is using session variables. Some reason you did not continue with your existing thread? Quote Link to comment https://forums.phpfreaks.com/topic/207045-tracking-a-var/#findComment-1082668 Share on other sites More sharing options...
gwolgamott Posted July 7, 2010 Share Posted July 7, 2010 probably because he had no response to an overcomplicated question. I didn't even realize was same person. Ha... Anyways... do as ken states. Be sure that you have session_starts at the top of the second page and you are not closing the session prior to the second page. session_start is needed on every page that uses that same session if you do not have it already. apon looking at your other post here's the problem possibly...if the same project... your session_start is below the where you are trying to get the session_id.... needs to be the other way around. <?php SESSION_ID($_GET['sid']); SESSION_START(); print_r($_SESSION); ?> //try this instead <?php SESSION_START(); SESSION_ID($_GET['sid']); print_r($_SESSION); ?> Quote Link to comment https://forums.phpfreaks.com/topic/207045-tracking-a-var/#findComment-1082676 Share on other sites More sharing options...
M.O.S. Studios Posted July 7, 2010 Author Share Posted July 7, 2010 the session_id() comes before start_session(), standard syntax Quote Link to comment https://forums.phpfreaks.com/topic/207045-tracking-a-var/#findComment-1082699 Share on other sites More sharing options...
M.O.S. Studios Posted July 8, 2010 Author Share Posted July 8, 2010 Sorry about the repost, this post wasn't suppose to turn into the same issue as the other one, just worked out that way. I did figure out where the issue was, I'm still having the other problem so I'm going to continue over there. thanks for the help Quote Link to comment https://forums.phpfreaks.com/topic/207045-tracking-a-var/#findComment-1082966 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.