0
I do so to make a query in the Mysql database
$keyword = strval($_POST['query']);
$search_param = "{$keyword}%";
$conn =new mysqli('xxx', 'xxx', 'xxx' , 'xxx');
$sql = $conn->prepare("SELECT * FROM empresas WHERE nome LIKE ? or palavras_chave LIKE ?")
$sql->bind_param("s",$search_param);
$sql->execute();
$result = $sql->get_result();
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
$countryResult[] = $row["nome"];
}
echo json_encode($countryResult);
}
$conn->close();
Are you just looking for the name, as I would to also search another column of mysql? For example name and keywords.
("... name LIKE ? AND name = 'something'") is that what you want? I didn’t quite understand the question
– Woton Sampaio