10-28-2018, 05:40 PM
@Brandin might have better info on this, but I don't normally bind limits and offsets. I tend to do something like this
$limit = 7;
$offset = 2;
$db->query("SELECT *, DATE_FORMAT(l.date, "%m/%d/%Y") as `date`
FROM db_listings l
WHERE l.omit=0
AND l.closed=0
ORDER BY l.id DESC LIMIT $limit OFFSET $offset")->results();
Due to the fact that there isn't really a sql injection vector (that I know of) in PDO for Limits and offsets. But Brandin is your guy when it comes to SQL.
$limit = 7;
$offset = 2;
$db->query("SELECT *, DATE_FORMAT(l.date, "%m/%d/%Y") as `date`
FROM db_listings l
WHERE l.omit=0
AND l.closed=0
ORDER BY l.id DESC LIMIT $limit OFFSET $offset")->results();
Due to the fact that there isn't really a sql injection vector (that I know of) in PDO for Limits and offsets. But Brandin is your guy when it comes to SQL.