MySQL query not working while using php variable in where clause

后端 未结 3 1131
忘了有多久
忘了有多久 2021-01-23 16:02

I\'m new to PHP and MySQL. I am trying to make a simple search form using which I would want to show the results from the database based on the input text entered in the form. M

3条回答
  •  面向向阳花
    2021-01-23 16:48

    $query = "SELECT * FROM `cats` WHERE name='" . $name . "'";
    

    or without concatenation

    $query = "SELECT * FROM `cats` WHERE name='$name'";
    

提交回复
热议问题