// Getting motscles value
$motscles = $_POST['motscles'];
// Prepare a second SQL request to get all annonces posted by the user
$result2=$connexion->prepare("select * from annonces where titre LIKE = '%".$motscles."%' ");
我没有结果,我认为我的要求很糟糕..
此外@abhik's回答 如果你准备得当的话
$stmt=$connexion->prepare('select * from annonces where titre LIKE ?');
$result2=$stmt->execute(array('%'.$motscles.'%'));