-3
if($limit== '400'){
    $sql="SELECT * FROM report ORDER BY reportID ASC LIMIT $limit WHERE userID='$reportID'";}

says "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'WHERE userID='147'' at line 1".

Anybody who can help me. I'm a beginner in php programming language.

Vikash Pathak
  • 3,444
  • 1
  • 18
  • 32

1 Answers1

1

Where clause should be come before the Order By

Try this:

if($limit== '400'){
    $sql="SELECT * FROM report WHERE userID='$reportID' ORDER BY reportID ASC LIMIT $limit";
}
Vikash Pathak
  • 3,444
  • 1
  • 18
  • 32