Jump to content

How to search for several parameters from objects in a database?


beginann

Recommended Posts

I have a database with lots of information about objects.

Now I would like to search for 4 or 5 parameters at the same time (from a form) like this:

 

I choose from a select-box one parameter and then from another select-box (in the same form) another parameter.

Now I want all the objects that fit in with all the chosen parameters to be shown.

 

I have tried this:

$query = "SELECT * FROM vaxtlista WHERE farg='$farg' AND typ='$typ' ORDER BY vetenskapligt";	

 

and this:

$query = "SELECT * FROM vaxtlista WHERE (farg='$farg' AND typ='$typ') ORDER BY vetenskapligt";	

 

I don´t use LIKE and jokers because I know exactly what´s in the fields.

 

Nothing works.

 

Someone who has a clue about this? Please help!

I can not help then you don't use LIKE

 

have you tried echoing this out yet ?

 

$query = "SELECT * FROM vaxtlista WHERE farg='$farg' AND typ='$typ' ORDER BY vetenskapligt";

 

do all variables match correctly......

Yes, I have tried to echo that, but I only get a message that says that there are no objects matching these criterias (but I know there is!).

 

And I have tried to use LIKE also, the same result.

 

All variables are correct.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.