Answer the question
In order to leave comments, you need to log in
The request is not working correctly. What is the reason?
Hello friends, help me solve the problem, there is a sql query, it doesn’t work correctly or I’m wrong somewhere, I need your help!
SQL query:
$db->query("SELECT * FROM news" , 1);
$count_news = $db->num_rows();
list($pagertop, $pagerbottom, $limit) = pager('10', $count_news, 'news.php?');
$db->query("SELECT n.* , u.name AS user_name , u.class AS user_class , u.avatar
FROM news AS n
LEFT JOIN users AS u ON u.id = n.id_user
ORDER BY n.date DESC
".$limit."");
Answer the question
In order to leave comments, you need to log in
Run a raw SQL query in phpMyAdmin. You're using a LEFT JOIN, so all of the entries in news will get it. The problem in the request can only be with $limit . If there are no errors in the limit, and a clean request gets 3 news, then look for the problem further along the code. In a controller or view.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question