0

This SQL query isn't showing posts even though all of the "circumstances" are correct and are in the database. Query - $sql = "SELECT * FROM posts WHERE like BETWEEN 5 AND 25 AND bp='0' ORDER BY id DESC LIMIT 15 ";

Why isn't this working? How do I fix it?

Dharman
  • 30,962
  • 25
  • 85
  • 135
PHP Web Dev 101
  • 535
  • 2
  • 9
  • 21

1 Answers1

2

like is a reserved word, so you need to escape it:

SELECT *
FROM posts
WHERE `like` BETWEEN 5 AND 25  AND bp = '0'
ORDER BY id DESC
LIMIT 15 ;
Gordon Linoff
  • 1,242,037
  • 58
  • 646
  • 786