I have a list that passes values to an sql statement to show relevant results.

I have three options (All, Option One, Option Two) and cannot get the query to work.

If I choose option one or option two then the results are fine but I cannot find a way to display all results.

The code is below:

SELECT * from details WHERE otype = '$listoption'

SELECT * FROM details

Or, if for some reason you have to specify 'otype':

SELECT * FROM detail WHERE otype = '$listoptionA' OR otype = '$listoptionB'

It might be some issue in query to passing 'Option Two'.
Also check database with having value 'Option Two'.

Member Avatar for rajarajan2017
SELECT * from details

Without the option you just query the table name to retrieve all records. I am not sure what you are looking for?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.