This topic is locked
[SOLVED]

 help with query for email and drop down.

9/5/2010 11:47:26 AM
PHPRunner General questions
W
wildwally author

Having some trouble getting this my desired results. I have a couple tables
UserTB

...ID

...Name

...Email

...Phone
SqdTB

...ID

...Sqdname

...Name
AppTB

...ID

...NewName

...Sqd
My AppTB is like a register page When the user fills it out and selects a Sqd (lookup of SqdName). I need the email address to look at the UserTB email field. But It needs to find out who the Name in the SqdTB field is first then find the match of the name in the UserTB.
I was thinking a join thena where clause but i can't get the thing to work.
Heck I can't even get the where clause to work correctly in the standard lookup table. Trying to find condition for field not being selected. How does one work around that?
I am able to get the reult by using three lookup fields to display, but i want these fields hidden from the person signing up.

A
ann 9/9/2010

Wally,
Here is a sample code (the result is in the $data2["Email"] variable) for the After successful registration event:

$rs1=CustomQuery("select Name from SqdTB where Sqdname='".$userdata["Sqd"]."'");

$data1=db_fetch_array($rs1);

$rs2=CustomQuery("select Email from UserTB where Name='".$data1["Name"]."'");

$data2=db_fetch_array($rs2);