我有內部的變量$text = "sometexthere"
添加一個變量MySQL查詢
我想補充這一變量$text
以下MySQL查詢內,而不是sometexthere
$query = "SELECT sum(nbr) AS sum FROM table2 WHERE name LIKE '%sometexthere%'";
我試圖做的是在許多方式如
$query = "SELECT sum(stats) AS sum FROM download WHERE filename LIKE '%' . $text . '%'";
和
$name = "'%' . $text . '%'";
$query = 'SELECT sum(stats) AS sum FROM download WHERE filename LIKE '.$name.'';
但不工作:/
您還沒有爲此進行過Google搜索! –