I am trying to fetch all rows within a MySQL table that have a specific input within a particular column.
Here is my table:
ID COLOR LENGTH
--- ------- ------
19 red 10
3 green 45
24 blue 54
4 red 3
5 red 11
How would I fetch all the the rows that have "red" as the stored value within the "COLOR" column? Can somebody please help?
I am a newbie to MySQL/PHP, so forgive me if this is a stupid question. I tried looking all over but I could not find an answer to it
Since you’re a newbie, I’d like to recommend proper SQL coding. Name all the columns you need, even if you need all the columns that exist in your table. Avoid using the
SELECT * ...approach. Develop good practices and habits as early as today:A very basic example of how you’d get things done in PHP:
Here are links to articles that can help you get started:
net.tutsplus
phpeveryday
phpro