Mysql select with LIKE and php variable
Posted: 27 May 2016, 17:19
How can i create a %Like select where variable is a php variable.
Web Development and Programming Courses
https://coursesweb.net/forum/
Code: Select all
$varnm ='value';
$sql = "SELECT * FROM table_name WHERE col_name LIKE '%$varnm'";
Code: Select all
$varnm ='value';
$sql = "SELECT * FROM table_name WHERE col_1 LIKE '%$varnm' OR col_2 LIKE '%$varnm'";