Hi Harris,
I'm not convinced (yet) that it is correct. The SQL is:
[php]
SELECT COUNT(course_id) AS cnt FROM AT_courses WHERE access <>-1 AND cat_id <>-1 AND 1 AND hide=0
SELECT * FROM AT_courses WHERE access <>-1 AND cat_id <>-1 AND 1 AND hide=0 ORDER BY title
[/php]
The at_courses table:
[php]
INSERT INTO `at_courses` (`course_id`, `member_id`, `cat_id`, `content_packaging`, `access`, `created_date`, `title`, `description`, `course_dir_name`, `notify`, `max_quota`, `max_file_size`, `hide`, `copyright`, `primary_language`, `rss`, `icon`, `home_links`, `main_links`, `side_menu`, `release_date`, `end_date`, `banner`, `home_view`) VALUES
(1, 4, 3, 'top', 'private', '2010-10-28 16:28:46', 'Health and Safety', 'Test course', '', 1, '-2', '-3', 0, '', 'en', 0, 'books.jpg', 'mods/_standard/tests/my_tests.php|mods/_standard/tracker/my_stats.php|mods/_core/imscp/export.php', 'mods/_standard/faq/index.php|mods/certify/index.php|mods/ch_custom/index.php', '', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', 1),
(4, 1, 3, 'top', 'private', '2010-11-17 14:19:56', 'Manual Handling Awareness', 'Awareness of the dangers of handling things', '', 1, '-2', '-3', 0, '(c) Changing Horizon 2010', 'en', 0, 'mail.google.com.jpeg', 'mods/_standard/faq/index.php|mods/_standard/reading_list/index.php|mods/_standard/tests/my_tests.php|mods/_standard/tracker/my_stats.php', 'mods/certify/index.php|mods/job_board/index.php|mods/ch_custom/index.php', 'menu_menu|ch_custom|glossary|search', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', 1),
(5, 1, 4, 'top', 'private', '2010-11-17 14:53:59', 'Food Safety Course', '', '', 1, '-2', '-3', 0, '', 'en', 0, 'fly-fishing.jpg', 'mods/_standard/faq/index.php|mods/_standard/reading_list/index.php|mods/_standard/tests/my_tests.php|mods/_standard/tracker/my_stats.php', 'mods/certify/index.php|mods/job_board/index.php|mods/ch_custom/index.php', 'menu_menu|ch_custom|glossary|search', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', 1),
(2, 1, 3, 'top', 'public', '2010-11-02 12:55:39', 'Demo Health And Safety', 'This is a trial version of the Health and Safety Course.', '', 0, '-2', '-3', 0, '', 'en', 0, '', 'mods/_standard/file_storage/index.php|mods/_standard/tests/my_tests.php|mods/_standard/tracker/my_stats.php|mods/_standard/directory/directory.php', 'mods/_standard/forums/forum/list.php|mods/_core/glossary/index.php|mods/_standard/faq/index.php|mods/_standard/reading_list/index.php|mods/_standard/gradebook/my_gradebook.php|mods/_standard/student_tools/index.php|mods/_standard/tile_search/tile.php|mods/_core/groups/groups.php|mods/certify/index.php|mods/job_board/index.php|mods/ch_custom/index.php', 'social|menu_menu|related_topics|users_online|glossary|search|poll|posts', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', 1),
(3, 1, 3, 'top', 'private', '2010-11-02 15:32:49', 'Test Course', 'test', '', 1, '-2', '-3', 0, '', 'en', 0, '', 'mods/_standard/file_storage/index.php|mods/_standard/directory/directory.php|mods/_standard/tests/my_tests.php|mods/_standard/tracker/my_stats.php', 'mods/_standard/forums/forum/list.php|mods/_core/glossary/index.php|mods/_standard/faq/index.php|mods/_standard/reading_list/index.php|mods/_standard/gradebook/my_gradebook.php|mods/_standard/student_tools/index.php|mods/_standard/tile_search/tile.php|mods/_core/groups/groups.php|mods/certify/index.php|mods/job_board/index.php|mods/ch_custom/index.php', 'social|menu_menu|related_topics|users_online|glossary|search|poll|posts', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '', 1);
[/php]
As I mentioned earlier - all four (actually five including the now unhidden one) rows are returned for both queries, but because that line makes it skip one then it's not included in the list below.