cruxaders Posted March 21, 2011 Share Posted March 21, 2011 i got a problem on undefined index...but if i use Xampp i can run in nicely with our error..but in wamp it say undefined index... what i supposed to do.... so that i can run it in both xampp and wamp nicely Quote Link to comment https://forums.phpfreaks.com/topic/231293-undefined-index/ Share on other sites More sharing options...
MockY Posted March 21, 2011 Share Posted March 21, 2011 The issue is present in either case. The difference is that Xampp suppresses errors in the php.ini file. Either way, the issue is common when you don't enclose indexes in quotes, like when you fetch information from a database for example. So instead of $r[index], you should use $r['index'] Your code will still works however, even with these "errors" present. Quote Link to comment https://forums.phpfreaks.com/topic/231293-undefined-index/#findComment-1190407 Share on other sites More sharing options...
Pikachu2000 Posted March 21, 2011 Share Posted March 21, 2011 It may 'work' now, but what if a constant is defined with the same name as an unquoted index? It's also inefficient, as now php has to search for a constant by that name, then decide that none exists, and treat the value as a string. It also generates a notice, whether it's displayed or not, AFAIK. Quote Link to comment https://forums.phpfreaks.com/topic/231293-undefined-index/#findComment-1190420 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.