I wrote a very simple mysql line for my very simple search bar that searches keywords, but I ran through an error. (I have a feeling it’s because of the length of the search)
$query = "SELECT * FROM entries WHERE name='%".$search."%' ";
works, but
$query = "SELECT * FROM entries WHERE desc='%".$search."%' ";
doesn’t.
In the database, name has around 20 characters, and desc has around 700. I checked spelling and everything, it just outputs an error.
Does it not work because it has too many characters to scan through?
Thanks a lot (in advance)!
descis mysql key word, you need to quote it, and you should useLIKEinstead of=, and make sure your$searchhas been escaped.