如何使用比较运算符和文本数据?

How to use Comparison operator with text data ?

This is my table

http://image.ohozaa.com/i/51c/zBed4I.png

And this is my code.

<?PHP
include("connect.php");
$sql = "SELECT * FROM test_db WHERE number >= '3' AND number <= '5' order by id asc";
$result = mysql_query($sql);
$datas=mysql_fetch_array($result);{
$id = stripslashes(str_replace('
', '<br>',($datas['id'])));
}
?>

After test code, I will get result id 1 and 2

How can i do that ?

You could always change your table structure so that one value per column is stored. BUT work-around for your table structure could be this:

instead of '='use LIKE moreover, use something like this:

where number like '*[3-5]*'

please lookup for regex in sql, I am not very good in regex. but the basic idea is to use LIKE query and try match any pattern that starts with anything but has atleast either 3 or 4 or 5 in between and then has anything after that.