This topic is locked

"$values" It can be used in a "where" clausule?

3/10/2010 8:06:10 AM
PHPRunner General questions
A
Aleix author

Hi;
(PHPRunner 5.2 (Build 4905))
We want to do a dropdown dependent, but using WHERE, (No using dopdown option. In this way we will can do filters more specific)
Some like that:
WHERE "Area =" .$values("Area") We hope that Where clause filter the countries that belong to the Area that the user selected before
[indent]But It do not work,

Error Type 8

Undefined variable: values[/indent]
Are we doing some thing wrong or "$values" it can not be used in the page?
Are there another way for to filter the content of Dropdown box by the fields that the user wrote? (No using dopdown option. In this way we will can do filters more specific)
Thanks in advance
Aleix

Sergey Kornilov admin 3/10/2010

Instead of $values array which is not available here you can use a session variable i.e. WHERE "Area =" .$_SESSION["Area"].
Session variable can be populated in BeforeProcess or BeforeDisplay event of the Edit page.

A
Aleix author 3/13/2010

Hello Sergey;
First thanks for your time
I tried
WHERE "Area =" .$_SESSION["Area"] --> type error: 256; Description error:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') ORDER BY _zzubic01b_pais.IdUbicPais' at line 1

  1. SELECT DISTINCT UbicPais,UbicPais FROM _zzubic01b_pais WHERE (Area =) ORDER BY _zzubic01b_pais.IdUbicPais;
  2. Resource id #11;
    and try too with :
    WHERE "Area =" .$_SESSION[‘Area’] --> type error: 8; Description error: Use of undefined constant ‘Area’ - assumed '‘Area’'
    But in the both cases I have error. What am I doing badly?
    Thanks for your help
    Aleix

Sergey Kornilov admin 3/14/2010

You need to populate $_SESSION["Area"] variable in BeforeProcess or BeforeDisplay event of the Edit page. According to what I see this variable is not populated which causes SQL query error.