In the debug output it should be possible to see where each part of a query was created.
<div class="grubby debug">
table created in user_books.php line 12
filter user_id=10 in user.php line 423
order title in book_report.php line 27
limit 0, 10 in book_report.php line 27
read in book_report.php line 27
SELECT * FROM user_books WHERE user_id=10 ORDER BY title LIMIT 0, 10;
Time: 0.02 secs
When debugging we should also invoke an extra library that looks for errors. I.e. was a keyword used when creating a table, or are there unknown keys in the table array.