Reputation: 63
I'm trying to get this to work but I have no idea what's wrong with it.
$sql = "SELECT * FROM $datatable ORDER BY ID ASC LIMIT $start_from,
$results_per_page WHERE STATE='$category'" ;
The following one works and just shows the entire table. But I'm running into issues when I try to use WHERE STATE=Variable
$sql = "SELECT * FROM ".$datatable." ORDER BY ID ASC LIMIT $start_from, ".$results_per_page ;
Upvotes: 0
Views: 40
Reputation: 756
You should write "ORDER BY" after the "WHERE" part. In your case it should be something like:
$sql = "SELECT * FROM $datatable WHERE STATE='$category' ORDER BY ID ASC LIMIT $start_from, $results_per_page" ;
Upvotes: 1