How to use PHP string in mySQL LIKE query?

后端 未结 2 1904
感情败类
感情败类 2020-12-10 04:27

I am trying to find the number of rows that match a specific pattern. In this example, all that START with \"123\":

This is working:

$query = mysql_q         


        
2条回答
  •  囚心锁ツ
    2020-12-10 04:55

    DO it like

    $query = mysql_query("SELECT * FROM table WHERE the_number LIKE '$yourPHPVAR%'");
    

    Do not forget the % at the end

提交回复
热议问题