Nrc Nrc - 5 months ago 39
MySQL Question

Find text with like

I want to find text in a MySql database

$result = mysqli_query($con,"SELECT * FROM blog
WHERE text_post LIKE = 't%';
or die(mysqli_error());
while($row = mysqli_fetch_array($result)) {
echo $row['titol_post'] . "<br>";

It gives me the error:
mysqli_error() expects exactly 1 parameter, 0 given...

If I substitute

WHERE text_post LIKE = 't%';


WHERE text_post = 'test';

It works well. I do not undestand. Why the LIKE does not work?


I just changed like = to like and it works

SELECT * FROM blog WHERE text_post LIKE 't%'"