[2023-01-23] 4images 1.10 released
0 Members and 1 Guest are viewing this topic.
//-----------------------------------------------------//--- Show Image --------------------------------------//-----------------------------------------------------
//-----------------------------------------------------//--- START Show user images in profile ---------------//-----------------------------------------------------$imgtable_width = ceil(intval($config['image_table_width']) / $config['image_cells']);if ((substr($config['image_table_width'], -1)) == "%") { $imgtable_width .= "%";}$additional_sql = "";if (!empty($additional_image_fields)) { foreach ($additional_image_fields as $key => $val) { $additional_sql .= ", i.".$key; }}$sql = "SELECT COUNT(*) as user_count_images FROM ".IMAGES_TABLE." WHERE user_id = $user_id"; $row = $site_db->query_firstrow($sql); $user_total_images = $row['user_count_images'];$site_template->register_vars("user_total_images", $user_total_images);unset($user_total_images);$user_images = 20; // SET HERE HOW MUCH IMAGES SHOULD BE SHOWN$sql = "SELECT COUNT(i.user_id) AS images FROM (".IMAGES_TABLE." i, ".CATEGORIES_TABLE." c) LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id) WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.user_id = $user_id AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").")"; $result = $site_db->query_firstrow($sql); $num_images = $result['images'];$site_db->free_result();$num_rows_all = (isset($num_images)) ? $num_images : 0;$link_arg = $site_sess->url(ROOT_PATH."member.php?action=showprofile&user_id=$user_id");include(ROOT_PATH.'includes/paging.php');$getpaging = new Paging($page, $user_images, $num_rows_all, $link_arg);$offset = $getpaging->get_offset();$site_template->register_vars(array("paging" => $getpaging->get_paging(),"paging_stats" => $getpaging->get_paging_stats()));$sql = "SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits".$additional_sql.", c.cat_name".get_user_table_field(", u.", "user_name")." FROM (".IMAGES_TABLE." i, ".CATEGORIES_TABLE." c) LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id) WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.user_id = $user_id AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").") ORDER BY i.image_date DESC LIMIT $offset, $user_images";$result = $site_db->query($sql);$num_rows = $site_db->get_numrows($result);if (!$num_rows) { $user_profile_images = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\"><tr class=\"imagerow1\"><td>"; $user_profile_images .= $lang['no_new_images']; $user_profile_images .= "</td></tr></table>";}else { $user_profile_images = "<table width=\"".$config['image_table_width']."\" border=\"0\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"".$config['image_table_cellspacing']."\">"; $count = 0; $bgcounter = 0; while ($image_row = $site_db->fetch_array($result)){ if ($count == 0) { $row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2; $user_profile_images .= "<tr class=\"imagerow".$row_bg_number."\">\n"; } $user_profile_images .= "<td width=\"".$imgtable_width."\" valign=\"top\">\n"; show_image($image_row); $user_profile_images .= $site_template->parse_template("thumbnail_bit"); $user_profile_images .= "\n</td>\n"; $count++; if ($count == $config['image_cells']) { $user_profile_images .= "</tr>\n"; $count = 0; } } // end while if ($count > 0) { $leftover = ($config['image_cells'] - $count); if ($leftover >= 1) { for ($f = 0; $f < $leftover; $f++) { $user_profile_images .= "<td width=\"".$imgtable_width."\">\n \n</td>\n"; } $user_profile_images .= "</tr>\n"; } } $user_profile_images .= "</table>\n";} // end else$site_template->register_vars("user_profile_images", $user_profile_images);unset($user_profile_images);//-----------------------------------------------------//--- END Show user images in profile -----------------//-----------------------------------------------------
DB Error: Bad SQL Query: SELECT COUNT(*) as user_count_images FROM 4images_images WHERE user_id = You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3DB Error: Bad SQL Query: SELECT COUNT(i.user_id) AS images FROM (4images_images i, 4images_categories c) LEFT JOIN 4images_users u ON (u.user_id = i.user_id) WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.user_id = AND i.cat_id NOT IN (0)You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND i.cat_id NOT IN (0)' at line 4DB Error: Bad SQL Query: SELECT i.image_id, i.cat_id, i.user_id, i.image_name, i.image_description, i.image_keywords, i.image_date, i.image_active, i.image_media_file, i.image_thumb_file, i.image_download_url, i.image_allow_comments, i.image_comments, i.image_downloads, i.image_votes, i.image_rating, i.image_hits, i.image_aboutme, i.image_realname, i.image_birthday, i.image_interests, i.image_network, i.image_chatnick, i.image_chatchan, i.image_icq, i.image_email, i.image_phone, i.image_aboutlove, i.image_aboutpet, i.image_petname, i.image_petbreed, i.image_petage, i.image_aboutavto, i.image_avtomodel, i.image_avtoyear, i.image_aboutvirt, i.image_virtgame, i.image_aboutprotest, c.cat_name, u.user_name FROM (4images_images i, 4images_categories c) LEFT JOIN 4images_users u ON (u.user_id = i.user_id) WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.user_id = AND i.cat_id NOT IN (0) ORDER BY i.image_date DESC LIMIT 0, 20You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND i.cat_id NOT IN (0) ORDER BY i.image_date DESC LIMIT 0, 20' at line 4Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in D:\www\people\includes\db_mysql.php on line 116
WHERE user_id = $user_id";
WHERE user_id = " . $image_row['user_id'];
WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.user_id = $user_id AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").")";
WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.user_id = " . $image_row['user_id'] . " AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").")";
$link_arg = $site_sess->url(ROOT_PATH."member.php?action=showprofile&user_id=$user_id");
$link_arg = $site_sess->url(ROOT_PATH."member.php?action=showprofile&user_id=" . $image_row['user_id']);
WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.user_id = $user_id AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").")
WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.user_id = " . $image_row['user_id'] . " AND i.cat_id NOT IN (".get_auth_cat_sql("auth_viewcat", "NOTIN").")