This topic is locked

Radio Button Look up Query

1/14/2009 3:18:13 PM
PHPRunner General questions
vin7102 author

Hi
On an "Add Record" page I want to use a radio button for selecting a crew member name.

The lookup table is called "my_crew" and it contains fields called "id", "crew_member", and "crew_foreman".

I would like to show the crew_members as radio buttons but only show those where the session ownerID is = to the crew foreman name

I've tried using the WHERE tool in the Edit as page but with no luck.. I just had the wrong syntax i guess.
Thanks in Advance

J
Jane 1/15/2009

Vince,
please post WHERE clause you use on the "Edit as" settingsdialog here.

vin7102 author 1/15/2009

Hi Jane,
My WHERE clause is:

"Crew_Foreman=".$_SESSION["OwnerID"]


The Error description is: > Unknown column 'Vinny' in 'where clause'


And the sql query says:

select `Crew_Member`,`Crew_Member` from `my_crew` where Crew_Foreman=Vinny


Vinny is the session ownerID during this test but Im not sure why the error says Unknown column 'Vinny' in where clause. There is no "Vinny" column
Thanks

J
Jane 1/16/2009

Vince,
add single quotes around text value in your SQL query:

"Crew_Foreman='".$_SESSION["OwnerID"]."'"

vin7102 author 1/16/2009

Perfect..

Thank You

Still learning the syntax!