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


Posted on 16th Feb 2014 07:03 pm by admin

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.
Did you know?Explore Trending and Topic pages for more stories like this.
Now I want all the objects that fit in with all the chosen parameters to be shown.

I have tried this:
Code: $query = "SELECT * FROM vaxtlista WHERE farg='$farg' AND typ='$typ' ORDER BY vetenskapligt";
and this:
Code: $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
No comments posted yet

Your Answer:

Login to answer
294 Like 6 Dislike
Previous forums Next forums
Other forums

Session
I am having a little trouble with a session. Not sure if it is my browser or what. I know I do not

Any decent php formatter/beautifier/pretty printer?
Any decent php formatter/beautifier/pretty printer class/function?

I found the following whil

PHP/Database issue
My friend is helping me make a database where you go to a certain webpage of my site and the page wi

Print out contents of to Excel
I have got this script that gathers all the data that I need but I need it to send it to excel inste

Appending GET data with form submition
Okay, what I'm trying to do is to use a form to append an already existing GET data string.

I

Time-based image rotation script
I'm trying to write a PHP script that rotates an image based on what time of day it is. I want the

how to export excel file in same server
My first post - php newbie, so appreciate your support.

I'm currently using headers to save w

Shuffle Array
Hi,

I am writing a script for a game that needs players to randomly be assigned a target (ano

Delete all files in folder except with certain name
I have a script that I want to delete all files in a folder (taken from a database) except for one n

Parse Error
Hi Guys,

I have a function in my class which returns a string link variable. The problem is i

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash