I'm trying to query the vbulletin database on a custom table, and paginate the results. From the code I have, for some reason it only returns 40 total results. I'm having trouble with the $total_results part, can anyone help me out?
Thanks.
PHP Code:
<?php
// If current page number, use it, if not, set one.
if(!isset($_GET['page'])){
$page = 1;
} else {
$page = $_GET['page'];
}
// Define the number of results per page.
$max_results = 10;
$from = (($page * $max_results) - $max_results);
$query = $vbulletin->db->query_read("SELECT test1.test_name,
test1.test_ID, test2.test_name, test2.test_ID
WHERE test1.test_ID =
test2.test_ID ORDER BY test1.test_name ASC LIMIT
$from, $max_results");
// Figure out the total number of results in DB.
$total_results = $vbulletin->db->query_read("SELECT COUNT(*)
FROM test1,
test2");