I have a my sql database that lists screenshots. I want the output in three columns instead of one. Currently I have three identical queries pulling the same data. I would like to set up the queries so that each one will pull 1/3 of the images OR so that I can stagger each to pull every third. The code is below. Thoughts?
mysql_select_db($database_conn_guard, $conn_guard);
$query_rs_sc1 = "SELECT `tbl_screenshots`.`screenshots_id`, `tbl_screenshots`.`screenshots_author_id`, `tbl_screenshots`.`screenshots_images`, `tbl_screenshots`.`screenshots_caption`, `tbl_screenshots`.`screenshots_date`, `tbl_users`.`user_fname`, `tbl_users`.`user_lname`, `tbl_users`.`user_email`, `tbl_users`.`user_id`, `tbl_rank`.`rank_id`, `tbl_rank`.`rank_value`, `tbl_rank`.`rank_abr`, `tbl_users`.`user_rank_id`, CONCAT(`tbl_users`.`user_fname`,' ',`tbl_users`.`user_lname`) as name FROM `tbl_screenshots` INNER JOIN `tbl_users` ON (`tbl_screenshots`.`screenshots_author_id` = `tbl_users`.`user_id`) INNER JOIN `tbl_rank` ON (`tbl_users`.`user_rank_id` = `tbl_rank`.`rank_id`)";
$rs_sc1 = mysql_query($query_rs_sc1, $conn_guard) or die(mysql_error());
$row_rs_sc1 = mysql_fetch_assoc($rs_sc1);
$totalRows_rs_sc1 = mysql_num_rows($rs_sc1);
mysql_select_db($database_conn_guard, $conn_guard);
$query_rs_sc2 = "SELECT `tbl_screenshots`.`screenshots_id`, `tbl_screenshots`.`screenshots_author_id`, `tbl_screenshots`.`screenshots_images`, `tbl_screenshots`.`screenshots_caption`, `tbl_screenshots`.`screenshots_date`, `tbl_users`.`user_fname`, `tbl_users`.`user_lname`, `tbl_users`.`user_email`, `tbl_users`.`user_id`, `tbl_rank`.`rank_id`, `tbl_rank`.`rank_value`, `tbl_rank`.`rank_abr`, `tbl_users`.`user_rank_id`, CONCAT(`tbl_users`.`user_fname`,' ',`tbl_users`.`user_lname`) as name FROM `tbl_screenshots` INNER JOIN `tbl_users` ON (`tbl_screenshots`.`screenshots_author_id` = `tbl_users`.`user_id`) INNER JOIN `tbl_rank` ON (`tbl_users`.`user_rank_id` = `tbl_rank`.`rank_id`)";
$rs_sc2 = mysql_query($query_rs_sc2, $conn_guard) or die(mysql_error());
$row_rs_sc2 = mysql_fetch_assoc($rs_sc2);
$totalRows_rs_sc2 = mysql_num_rows($rs_sc2);
mysql_select_db($database_conn_guard, $conn_guard);
$query_rs_sc3 = "SELECT `tbl_screenshots`.`screenshots_id`, `tbl_screenshots`.`screenshots_author_id`, `tbl_screenshots`.`screenshots_images`, `tbl_screenshots`.`screenshots_caption`, `tbl_screenshots`.`screenshots_date`, `tbl_users`.`user_fname`, `tbl_users`.`user_lname`, `tbl_users`.`user_email`, `tbl_users`.`user_id`, `tbl_rank`.`rank_id`, `tbl_rank`.`rank_value`, `tbl_rank`.`rank_abr`, `tbl_users`.`user_rank_id`, CONCAT(`tbl_users`.`user_fname`,' ',`tbl_users`.`user_lname`) as name FROM `tbl_screenshots` INNER JOIN `tbl_users` ON (`tbl_screenshots`.`screenshots_author_id` = `tbl_users`.`user_id`) INNER JOIN `tbl_rank` ON (`tbl_users`.`user_rank_id` = `tbl_rank`.`rank_id`)";
$rs_sc3 = mysql_query($query_rs_sc3, $conn_guard) or die(mysql_error());
$row_rs_sc3 = mysql_fetch_assoc($rs_sc3);
$totalRows_rs_sc3 = mysql_num_rows($rs_sc3);
mysql_select_db($database_conn_guard, $conn_guard);
$query_rs_sc1 = "SELECT `tbl_screenshots`.`screenshots_id`, `tbl_screenshots`.`screenshots_author_id`, `tbl_screenshots`.`screenshots_images`, `tbl_screenshots`.`screenshots_caption`, `tbl_screenshots`.`screenshots_date`, `tbl_users`.`user_fname`, `tbl_users`.`user_lname`, `tbl_users`.`user_email`, `tbl_users`.`user_id`, `tbl_rank`.`rank_id`, `tbl_rank`.`rank_value`, `tbl_rank`.`rank_abr`, `tbl_users`.`user_rank_id`, CONCAT(`tbl_users`.`user_fname`,' ',`tbl_users`.`user_lname`) as name FROM `tbl_screenshots` INNER JOIN `tbl_users` ON (`tbl_screenshots`.`screenshots_author_id` = `tbl_users`.`user_id`) INNER JOIN `tbl_rank` ON (`tbl_users`.`user_rank_id` = `tbl_rank`.`rank_id`)";
$rs_sc1 = mysql_query($query_rs_sc1, $conn_guard) or die(mysql_error());
$row_rs_sc1 = mysql_fetch_assoc($rs_sc1);
$totalRows_rs_sc1 = mysql_num_rows($rs_sc1);
mysql_select_db($database_conn_guard, $conn_guard);
$query_rs_sc2 = "SELECT `tbl_screenshots`.`screenshots_id`, `tbl_screenshots`.`screenshots_author_id`, `tbl_screenshots`.`screenshots_images`, `tbl_screenshots`.`screenshots_caption`, `tbl_screenshots`.`screenshots_date`, `tbl_users`.`user_fname`, `tbl_users`.`user_lname`, `tbl_users`.`user_email`, `tbl_users`.`user_id`, `tbl_rank`.`rank_id`, `tbl_rank`.`rank_value`, `tbl_rank`.`rank_abr`, `tbl_users`.`user_rank_id`, CONCAT(`tbl_users`.`user_fname`,' ',`tbl_users`.`user_lname`) as name FROM `tbl_screenshots` INNER JOIN `tbl_users` ON (`tbl_screenshots`.`screenshots_author_id` = `tbl_users`.`user_id`) INNER JOIN `tbl_rank` ON (`tbl_users`.`user_rank_id` = `tbl_rank`.`rank_id`)";
$rs_sc2 = mysql_query($query_rs_sc2, $conn_guard) or die(mysql_error());
$row_rs_sc2 = mysql_fetch_assoc($rs_sc2);
$totalRows_rs_sc2 = mysql_num_rows($rs_sc2);
mysql_select_db($database_conn_guard, $conn_guard);
$query_rs_sc3 = "SELECT `tbl_screenshots`.`screenshots_id`, `tbl_screenshots`.`screenshots_author_id`, `tbl_screenshots`.`screenshots_images`, `tbl_screenshots`.`screenshots_caption`, `tbl_screenshots`.`screenshots_date`, `tbl_users`.`user_fname`, `tbl_users`.`user_lname`, `tbl_users`.`user_email`, `tbl_users`.`user_id`, `tbl_rank`.`rank_id`, `tbl_rank`.`rank_value`, `tbl_rank`.`rank_abr`, `tbl_users`.`user_rank_id`, CONCAT(`tbl_users`.`user_fname`,' ',`tbl_users`.`user_lname`) as name FROM `tbl_screenshots` INNER JOIN `tbl_users` ON (`tbl_screenshots`.`screenshots_author_id` = `tbl_users`.`user_id`) INNER JOIN `tbl_rank` ON (`tbl_users`.`user_rank_id` = `tbl_rank`.`rank_id`)";
$rs_sc3 = mysql_query($query_rs_sc3, $conn_guard) or die(mysql_error());
$row_rs_sc3 = mysql_fetch_assoc($rs_sc3);
$totalRows_rs_sc3 = mysql_num_rows($rs_sc3);