Link to home
Start Free TrialLog in
Avatar of BR
BRFlag for Türkiye

asked on

Selecting all data from the related category

Dear Experts,

I use php and mysql database

I have a drop down list where my user filter my category to see the related items.

My sql sentence is like

Select * from catagory_table where catagory='$category' order by id

I want to add to my drop down list an "all" option.

How can i write an sql to bring all the data from category table if my user selects "all" as an option.

Do i need another a coloumn in the database? Or should i use and if statement for sql statement like:

If the user selects "all" as an option, use this sql sentence otherwise use this sql sentence?
ASKER CERTIFIED SOLUTION
Avatar of Marco Gasi
Marco Gasi
Flag of Spain image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of BR

ASKER

Thank you Marco, Thank you Ray