Nrc Nrc - 1 year ago 95
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?

Answer Source

I just changed like = to like and it works

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download