首次加载时数据库错误,但刷新时没有

When my web page first loads it displays my query and says Database Error. While refreshing the page loads successfully. Can anyone know why does this occurs?

This issue is with my Production server not on Staging or Dev environment.

This is the error message:

A Database Error Occurred

Error Number:

SELECT U.USER_ID, U.USER_NAME, U.NAME, U.DESIGNATION, U.EMAIL_ADDRESS, A.CURR_ROLE_ID, A.ROLE_TYPE_ID FROM DOP_USERS U JOIN DOP_ACCESS A ON U.USER_ID = A.USER_ID WHERE UPPER(U.USER_NAME) = 'BSNL.HO'

I'm using PHP 5.1.1, Oracle 11G and Code Igniter 1.7

This issue occurs while there is no COOKIE value set in Browser...

This issue occurs while there is no COOKIE value set in Browser...

Are you retrieving something from the cookie and using it in your query?

Your application might be grabbing a value from a cookie and plugging it directly into the sql without checking if the value exists or is valid first. That's one possible explanation why you get errors on initial load. The cookie may be created on the first page load AFTER the database call has been made, resorting in that error. Then when you refresh the page, the cookie is already there so the error goes away.