$query = "
SELECT
id,
overskrift,
tekst,
detaljer,
varenummer,
lager,
vegt,
pris,
billede,
fallow_id
FROM davidsen_vare
WHERE
overskrift LIKE ? OR varenummer LIKE ?)
LIMIT 30";
$Statement = $this->mysqli->prepare($query);
$Statement->bind_param("ss","%$sogning%","%$sogning%"); //error here
$Statement->execute();
$Statement->bind_result($id,$overskrift,$tekst,$detaljer,$varenummer,$lager,$vegt,$pris,$billede,$fallow_id);
有人可以帮忙吗
答案 0 :(得分:2)
$query = "
SELECT
id,
overskrift,
tekst,
detaljer,
varenummer,
lager,
vegt,
pris,
billede,
fallow_id
FROM davidsen_vare
WHERE
( overskrift LIKE %?%
OR varenummer LIKE %?%)
LIMIT 30";
$Statement = $this->mysqli->prepare($query);
$Statement->bind_param("ss",$sogning,$sogning);
OR
$query = "
SELECT
id,
overskrift,
tekst,
detaljer,
varenummer,
lager,
vegt,
pris,
billede,
fallow_id
FROM davidsen_vare
WHERE
( overskrift LIKE ?
OR varenummer LIKE ?)
LIMIT 30";
$Statement = $this->mysqli->prepare($query);
$Statement->bind_param("ss",'%'.$sogning.'%','%'.$sogning.'%');