Selecting all data from the related category
Posted on 2016-11-13
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?