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
  • 26,923
  • 21
  • 73
  • 125
PHP Web Dev 101
  • 525
  • 1
  • 8
  • 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,198,228
  • 53
  • 572
  • 709