mercredi 1 juillet 2015

php query for every record with the same value

I want to detect all records with the same value ( in mysql table ). For each detected record the code should run a while loop where all the records in the same row will be stored into values.

so if i have a table like this in mysql:

| fruit      | drink  | food   |
| apple      | cola   | chips  |
| cherry     | fanta  | chips  |
| banana     | sprite | potato |
| strawberry | milk   | chips  |

and i type in "chips" in my query the code shoult print this:

| apple      | cola   | chips  |
| cherry     | fanta  | chips  |
| strawberry | milk   | chips  |

I also want to store all the records in an array or an variable. What is the fastest and easiest way to do this?

Thank you

Aucun commentaire:

Enregistrer un commentaire