Weird problem displaying data.

Ok, this is a real weird one.  When I display a page I'm getting an undefined index error.  If you click the back button on the browser or the back button on the page, and click the same record it works.  Also when the page displays the error, if you click the refresh button on the browser it works!!

This only occurs the 1st time you click on a record to display.  After that it works!!!

This code is used several times throughout the site and it only happens here.  If you would like to see it in action let me know and I'll give you the site and login and instructions on how to duplicate the problem.

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ray PaseurCommented:
Undefined index usually refers to an array with an empty position.  The act of loading the page may cause the empty position to be filled after the page has loaded, or there may be other things afoot, such as an unstarted session.

Usually such messages come with a line number, so you can see the exact line of code that is failing.  you can see what the array contained by using var_dump().
breeze351Author Commented:
But why would refreshing the page solve the problem?  The 1st page displays 3 records, you click on record 1, you get the error.  Go back and click on record 1 again, no error!
Ray PaseurCommented:
I don't know - there is not enough information here to know - no message text, no PHP code, no test data.  Anything I might propose would just be a guess.  The way I would approach this problem would be to set up a test data set, and add some var_dump() statements to the code so I could see it in action.  There is probably something that was written with the assumption that PHP would fill in missing variables with a "falsy" value.  For novice programmers, this is a common assumption because PHP out of the box suppresses the Notice-level messages.  However if you raise the error reporting (as any professional should) you can catch things like this.

FWIW, the only time I have ever hit this kind of error in my own code was when I looked for a value in a cookie that was not there if the client had never visited the web site before.  The way I fixed it was by testing the field to see if it was empty() and filling in a NULL value as a placeholder to define the field.
Fundamentals of JavaScript

Learn the fundamentals of the popular programming language JavaScript so that you can explore the realm of web development.

breeze351Author Commented:
Check this out.
User: sales
ID: lc

Step 1:
Click on "Address Search
Street #: 400
Street Name: mad
Click on any one and it will display the detail.

Step 2:
Click on "Walk By Map"
Keyin the same street # and name.
You will see one line that says "Vacant [3]".
Click on this.
You get the same display from step number 1.

Now here is it gets weird.  When you click on one of the listings you get an error.  But if you hit refresh or go back and click on the same record it works.
breeze351Author Commented:
I've requested that this question be closed as follows:

Accepted answer: 0 points for breeze351's comment #a40914145

for the following reason:

Found it.  The var_dump set me in the right direction.  Thanks
Ray PaseurCommented:
Was there some reason you did not want to accept the comment that recommended the use of var_dump()?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
breeze351Author Commented:
Found it.  The var_dump set me in the right direction.  Thanks
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.