This topic is locked

How can I display the city name with the place dropdown list

5/6/2010 11:10:59 AM
PHPRunner General questions
E
eng.mjarkas author

Hi all ,

I have 3 tables ( 1.Cities , 2.Places , 3.Stores )
When I want to add new store , one of the fields is PID ( place id )

but the problem that I have same place name but different city

I set the PID option to lookup wizard , select the table and link PID to id in the master table
My question is :

how can I display the lookup like this ?
Pl_name ( City_name )
I mean add the city name to the lookup wizard so the admin can discriminate the right place in the right city
Fast Example :

I have cities : Paris , London

I have Places : test , test , test1
I want to the option to appear like this :

test(Paris)

test(London)

test1(London)
thanks alot

A
ann 5/11/2010

Hi,
Create view in your database directly using any MySQL administrative tool (phpMyAdmin for example). Check syntax of CREATE VIEW statement here:

CREATE VIEW Places_Of_Cities AS

SELECT

PID,

`CONCAT(Places.Pl_name, "(", City_name, ")")` AS Place_of_City

FROM Places JOIN Cities WHERE Places.PID=Cities.PID


Thereafter pick the Places_Of_Cities table as a source table in the Lookup Wizard.