"Select Multiple Option" by lookup table

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
peoplecreative
User
Posts: 24

"Select Multiple Option" by lookup table

Post by peoplecreative »

I want to do a multiple select by lookup tables and then store the selected values to the main table.
How can I do this by PHPMaker?

thanks a lot

Cheers,
Anthony


scs
User
Posts: 694

Post by scs »

Use checkbox.

Just gonna make sure your store field is big enough to store the value.


danielc
User
Posts: 1601

Post by danielc »

Use Select Tag to enable "Multiple" in Edit Tag. See Field Setup in help file.


peoplecreative
User
Posts: 24

Post by peoplecreative »

Many thanks. Sorry because I am the beginner.

I just know 1 table field has to link up with the lookup table for 1 value and then store back to the table field.
For example:

Main Table

id_no INT(2)
lookup_id INT(2) -> for storing 1 lookup value

Lookup Table

lookup_id INT(2)
lookup_name VCHAR(30)

If for mulitple selected in lookup, how to store back to 1 table field or I need to create many field to store the selections?

please kindly advice.


scs
User
Posts: 694

Post by scs »

peoplecreative wrote:

Main Table

id_no INT(2)
lookup_id INT(2) -> for storing 1 lookup value

Maybe you can try this way,
lookup_id VARCHAR(x) -> Adjust the size (x) as per needed.


peoplecreative
User
Posts: 24

Post by peoplecreative »

It works, thanks a lot.

But I find another problem is "SELECT IN SELECT" problem in MySQL
1) the result of sql statment "SELECT rsa_lookup_id FROM rsa_policy_plan_lookup WHERE rsa_plan_id=1" is equal to "11,12,16"

2) Runing in MySQL properly if the sql statment "SELECT rsa_eventNature_id, rsa_eventNature_name FROM rsa_eventnature WHERE rsa_eventNature_id IN (11,12,16) -> NO Problem~! 3 records showed

However, if I try to combine 1 & 2 into the sql statment "SELECT rsa_eventNature_id, rsa_eventNature_name FROM rsa_eventnature WHERE rsa_eventNature_id IN (SELECT rsa_lookup_id FROM rsa_policy_plan_lookup WHERE rsa_plan_id=1) "
the result is not the same #2. Only 1 record
Why??? How to solve?

Much thanks.


danielc
User
Posts: 1601

Post by danielc »

Use JOIN instead. Google for "mysql subquery inside in clause" to find out.


Post Reply