PHP read specific row [closed]
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Closed 9 years ago.
Improve this questionI have a PHP script that display开发者_如何学运维s data read from a MySQL database. I want to filter the output to only show rows where two columns contain specific values. How do I do this?
Add a WHERE
clause, e.g., WHERE column1 = 'specific-value1' AND column2 = 'specific-value2'
Here's a link to MySQL's SELECT syntax:
http://dev.mysql.com/doc/refman/5.1/en/select.html
(and in German):
http://dev.mysql.com/doc/refman/5.1/de/select.html
no idea why you are posting in german on an english site and then translating it to english. But what you need to do is something like "select * from table where column1='val' and column2='val'". Though it sounds like you have a large set of data pulled off already and you want to filter that. I don't see why you shouldn't just query what you need from the database instead of pulling everything off and then filtering.
精彩评论