Forum Moderators: coopster

Message Too Old, No Replies

help with real estate site in php

drop down list

         

MrFahad

5:14 pm on Nov 7, 2008 (gmt 0)

10+ Year Member



Hello,
I'm new here and in php as well i really find this site helpful and considering subscribing to it, anyways I'm doing a real estate site as my IGCSE computer studies course work and i was wondering if someone can help with the following:

i have a field "property_type" i want it to have 3 default values which are "building, villa, warehouse" and when a user (the admin) want to add property he will have a drop down list with the 3 values i said before

Thank you :)

sonjay

7:31 pm on Nov 7, 2008 (gmt 0)

10+ Year Member



What's your question?

MrFahad

9:02 pm on Nov 7, 2008 (gmt 0)

10+ Year Member



my question is how to:
have 3 default values which are "building, villa, warehouse" for property_type field in my database and when a user (the admin) want to add property he will have a drop down list with the 3 values i said before

Thank you :)

venelin13

2:20 pm on Nov 8, 2008 (gmt 0)

10+ Year Member



The straight answer of your question is to setup the property_type column as enum type:

property_type enum('building', 'villa', 'warehouse') not null default 1

But I think this is not the optimized solution. A better one is to have a separate table "property_types" with two columns - property_type_id and property_type_name. Than, in the properties table, you will store just the property_type_id number. This will be foreign key to the "property_types" database table.