Announcement

Collapse
No announcement yet.

Narrowing down "Undefined Offset"

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Narrowing down "Undefined Offset"

    Is there a way to quickly identify the culprit when this error pops up?


    "Error Close
    Undefined offset: 0" is hardly descriptive and takes time to pinpoint the source.

  • #2
    In most cases it is because you are trying to access the data from db-operation but the select returned an empty record set.
    To avoid the error you always have to check after sc_lookup(), sc_select() wether your sql operation returned useful data.

    See there (Ex. 2): http://www.scriptcase.net/docs/en_us...cros#sc_lookup

    jsb

    Comment


    • #3
      Originally posted by jsbinca View Post
      In most cases it is because you are trying to access the data from db-operation but the select returned an empty record set.
      To avoid the error you always have to check after sc_lookup(), sc_select() wether your sql operation returned useful data.

      See there (Ex. 2): http://www.scriptcase.net/docs/en_us...cros#sc_lookup

      jsb
      You're right. It also occurs with e.g. trying to access an unset array element. I was hoping there might be an SC or PHP configuration that would disclose the exact variable at run time.

      Comment

      Working...
      X