jasonc Posted October 2, 2011 Share Posted October 2, 2011 I can not seem to get this to work so wondered if I can do this or not. $_SESSION['ref123'] = "my item"; for some reason it is not storing when i try this, how do I allow letters ? Quote Link to comment https://forums.phpfreaks.com/topic/248300-can-i-have-ref123-ref456-as-references-in-sessions/ Share on other sites More sharing options...
mikesta707 Posted October 2, 2011 Share Posted October 2, 2011 Do you have the session_start() statement at some point before that code? Quote Link to comment https://forums.phpfreaks.com/topic/248300-can-i-have-ref123-ref456-as-references-in-sessions/#findComment-1275044 Share on other sites More sharing options...
jasonc Posted October 2, 2011 Author Share Posted October 2, 2011 yes, on all pages. but what seems to be failing is that the ID has a letter in it somewhere, i.e. abc123, abc123z all the references with just numbers works ok, it seems to be just the ones with letters in it. Quote Link to comment https://forums.phpfreaks.com/topic/248300-can-i-have-ref123-ref456-as-references-in-sessions/#findComment-1275045 Share on other sites More sharing options...
mikesta707 Posted October 2, 2011 Share Posted October 2, 2011 Hmm well array key naming rules don't restrict the use of numbers so I couldn't imagine why that key would be giving you trouble when numeric keys aren't. Try doing print_r on session to see what it has in it. You could also try posting your other relevant code to see if maybe there is an error in something you do with the $_SESSION Quote Link to comment https://forums.phpfreaks.com/topic/248300-can-i-have-ref123-ref456-as-references-in-sessions/#findComment-1275046 Share on other sites More sharing options...
jasonc Posted October 2, 2011 Author Share Posted October 2, 2011 I could not for the life of my work out why this would not have worked. I was sure I had read up that this was possible and continued using this method until I had over 1000 products in my custom cart, then found the bug!! ouch....! I have found the bug in my code I was checking if the reference is_numeric before allow the products to be added! Thank you for confirming that this was possible as I was about to redo the whole cart and images, before I found the fault in my code. Quote Link to comment https://forums.phpfreaks.com/topic/248300-can-i-have-ref123-ref456-as-references-in-sessions/#findComment-1275056 Share on other sites More sharing options...
mikesta707 Posted October 2, 2011 Share Posted October 2, 2011 glad you found your problem. If your topic is solved you can click the topic solved button at the bottom of the thread, or simply indicate its solved and I can mark it solved for you. Quote Link to comment https://forums.phpfreaks.com/topic/248300-can-i-have-ref123-ref456-as-references-in-sessions/#findComment-1275058 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.