This topic is locked
[SOLVED]

 Lookup table & WHERE clause

1/24/2012 3:48:37 AM
PHPRunner General questions
S
Sergej author

Hi, all...

I am at a loss how to achieve the following...

I have T1 with user data and T2 with firm data...

i would like to autopopulate form for firm data with already existing user data...

i'm trying to do with lookup table - connected t1 field firm with T2 but when i try to enter Where clause - depending on logged user username which is unique

where "username = ".$_Session["OwnerID"]

username is field from t1 where the username is stored

i get sql error...

any help, advice, solution - will be much appreciated...

thank you very much

C
cgphp 1/24/2012

If T2 is the source of the lookup wizard, the field in the WHERE clause must be a field of the T2 table so, the username field must be a field of T2. The WHERE expression must be entered without the string "where".

S
Sergej author 1/24/2012



If T2 is the source of the lookup wizard, the field in the WHERE clause must be a field of the T2 table so, the username field must be a field of T2. The WHERE expression must be entered without the string "where".



Thank you Cristian, but T1 is the source table...i'm trying topopulate T2 fields with the indentical ones in T1 based on logged user. And username is field in T1.

C
cgphp 1/24/2012

Please, post the sql error.

S
Sergej author 1/24/2012




voila!

C
cgphp 1/24/2012

$_SESSION must be capitalized:

"username = ".$_SESSION["OwnerID"]
S
Sergej author 1/24/2012

still NOGO but thnx for your efforts

C
cgphp 1/24/2012
"username=".$_SESSION["UserID"]
S
Sergej author 1/24/2012


"username=".$_SESSION["UserID"]




yes you were right it should be capitalised but i also missed the straight quotes
"username='".$_SESSION["username"] . "'" now it works like a charm...thank you very much for all your efforts and persistence