Thank You Rembrandt !
Can You please tell me where should I paste the code if I want to display the number of users under all thumbnails ? Becouse I dont want to show it on details page but under every thumbnail on list page.
$sql = "SELECT l.lightbox_image_ids, u.user_id, l.user_id".get_user_table_field(", u.", "user_name")."
FROM (".LIGHTBOXES_TABLE." l, ".USERS_TABLE." u)
WHERE l.lightbox_image_ids LIKE '%$image_id%' AND u.user_id=l.user_id";
$result = $site_db->query($sql);
$lightbox_row = array();
while ($row = $site_db->fetch_array($result)) {
$lightbox_row[] = $row;
}
$site_db->free_result($result);
$num_rows = sizeof($lightbox_row);
if ($num_rows) {
for ($i = 0; $i < $num_rows; $i++) {
$lightbox_list .= "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=showprofile&".URL_USER_ID."=".$lightbox_row[$i]['user_id'])."\">".$lightbox_row[$i]['user_name']."</a>";
if ($i+1 != $num_rows) {
$lightbox_list .= ", ";
}
}
}
//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$site_template->register_vars(array(
"lightbox_list" => $lightbox_list,By the way I think that this solution will not be good because when mysql will have to search LIKE %image_id% for example 1000 records the database will die....I will try do it by adding new field in database to image table for example 4images_image.lightbox and by using UPDATE command I will add "+1" counter.
I don't know if it works but it will be much better solution in my opinion.
Maybe You can help me ?
Thanks again!