Mysql / php:选择文件扩展名类型简单查询?

I am trying to select all images from table. My column is file_ext and contains jpg, jpeg, mp3, avi and so on extensions.

How can i create SQL query like this?: AND file_ext = 'jpg, jpeg' or to select all extensions AND file_ext = '*' Because I do not want to write AND file_ext = 'jpg' AND file_ext = 'jpeg' ....

How do you guys solve problems like this? Thanks!

Try with IN like

SELECT * FROM table WHERE mycondition AND file_ext IN ('jpg','jpeg','png',....)

And ALso try to avoid mysql_* statements due to the entire ext/mysql PHP extension, which provides all functions named with the prefix mysql_*, is officially deprecated as of PHP v5.5.0 and will be removed in the future.

There are two other MySQL extensions that you can better Use: MySQLi and PDO_MySQL, either of which can be used instead of ext/mysql.