Announcement

Collapse
No announcement yet.

Error with macro in event onApplicationInit

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

  • Error with macro in event onApplicationInit

    hi, i have a error in SC in event onApplicationInit:

    if sql return data, SC do not show error; but when the sql do not return data, SC show an error:

    ERROR:
    Undefined property: form_mov_ent_ini::$Ini
    Trying to get property of non-object
    Undefined property: form_mov_ent_ini::$Ini
    Trying to get property of non-object


    In event onApplicationInit i have this script:

    $sql = "SELECT 1 FROM neg_ngcio where neg_cdgo = 2 ";
    sc_lookup(data, $sql );

    if ({data} === false)
    {
    sc_redir("control_message.php", v_message="Error de acceso a la base de datos");
    }
    elseif (empty({data}))
    {
    sc_redir("control_message.php", v_message="No tiene permiso para ingresar a este formulario");
    }
    else
    {
    [suc_cdgo_ent] = {data[0][0]};
    }

  • #2
    In the stage of onapplicationinit there is no database connection available yet, it's the first thing called when the application gets loaded. I think you need to move this to the onscriptinit event.
    Albert Drent
    aducom software netherlands
    scriptcase partner, reseller, support and (turn-key) development
    www.scriptcase.eu / www.scriptcase.nl

    Comment


    • #3
      THanks you Albert, it works fine.

      Comment

      Working...
      X