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

Display certain image depending on time of year
Hi, I am new to these forums and would really appreciate some advice on a piece of coding I have don

Change Age automatically
hi guys . im new to php , is it possible to change age value in mysql automatically when year change

Disable html within defined tags
I have a mysql database that allows users to enter content with html, but I also want to have a tag

How to secure my login data to my database?
Hi there,

It may be a stupid question but I don't know how to secure my login data to my data

word wrap in emails help needed
Hello, I understand how wordwrap works in php and have used it well before. However when I used wor

Anti Spam Code
Ok where do i start? Probably by telling you I have very little working knowledge of PHP and that I

Fetching META TAGS through
Hello everybody
I want to fetch meta tags of a domain.
It will be done from following code of

modifying a property of an object from a different class
I have 2 classes:
- Math
- Distance

in my math class, I have this line:
$distance =

Rand() help needed
Hi all,

Can someone explain and give me a quick example of how I would go about this?

Drawing Images in classes
I'm quite new to Object Oriented PHP. What I'm trying to do is draw some images but also have other

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