Author Topic: [Mod] Display random images on homepage, if no new images  (Read 67951 times)

0 Members and 1 Guest are viewing this topic.

Offline apnetz

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: [Mod] Display random images on homepage, if no new images
« Reply #30 on: January 28, 2010, 03:02:25 PM »
Quote from: V@no
hum...no
that answer made me look into the code... :lol:
replace:
Code: [Select]
       ORDER BY random_no DESC, i.image_date DESCwith:
Code: [Select]
       ORDER BY random_no DESC, RAND(), i.image_date DESC

This does not work on 1.7.7, no new images appear at all.

Offline Hagen-Roderich

  • Full Member
  • ***
  • Posts: 127
    • View Profile
    • Hof Jokers
Re: [Mod] Display random images on homepage, if no new images
« Reply #31 on: January 31, 2010, 02:28:29 PM »
I have tryed this MOD, but dont get it to work. (4images Version 1.77 but index.php shows version 1.76)
Error:
An unexpected error occured. Please try again later.

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /is/htdocs/47852/domainname/media/includes/db_mysql.php on line 116

After login as Admin the error is:

DB Error: Bad SQL Query: SELECT IF(i.image_date >= 1264340208,RAND()+1,1) as random_no, 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, c.cat_name, u.user_name FROM gallery_images i, gallery_categories c LEFT JOIN gallery_users u ON (u.user_id = i.user_id) WHERE i.image_active = 1 AND c.cat_id = i.cat_id AND i.cat_id IN (0, 264, 162, 132, 131, 130, 273, 252, 176, 150, 140, 108, 207, 219, 113, 275, 292, 257, 282, 261, 244, 255, 177, 144, 259, 122, 251, 191, 254, 186, 274, 142, 111, 204, 174, 272, 281, 283, 170, 136, 135, 237, 284, 296, 212, 217, 250, 234, 171, 208, 193, 265, 216, 262, 240, 209, 158, 256, 277, 178, 278, 247, 114, 201, 157, 290, 145, 196, 214, 185, 197, 198, 222, 260, 203, 258, 263, 295, 106, 133, 235, 141, 206, 143, 233, 189, 112, 169, 210, 179, 146, 276, 168, 269, 246, 194, 159, 213, 253, 215, 238, 243, 288, 123, 172, 151, 134, 109, 202, 220, 232, 271, 115, 279, 245, 124, 293, 267, 164, 147, 192, 116, 249, 205, 165, 125, 137, 218, 160, 231, 195, 211, 184, 118, 294, 161, 242, 163, 280, 200, 270, 199, 166, 138, 126, 149, 180, 190, 230, 285, 239, 268, 181, 156, 297, 119, 167, 139, 127, 148, 229, 183, 120, 152, 236, 286, 128, 107, 228, 298, 287, 182, 187, 153, 129, 227, 121, 154, 289, 226, 155, 291, 225, 224, 223) ORDER BY random_no DESC, i.image_date DESC LIMIT 3
Unknown column 'i.user_id' in 'on clause'

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /is/htdocs/47852/domainname/media/includes/db_mysql.php on line 116

No Images are showend

What went wrong?
http://www.4homepages.de/forum/index.php?topic=22668.0? MySQL is V 5.0.32
"If your 4images is newer then v1.7.1 and you still get these errors, then you must have installed a mod that is not MySQL v5 compatible." Does thise mean this MOD is not MySQL v5 compatible? If so how to change the code to work with MySQL v5?
« Last Edit: February 01, 2010, 08:00:42 PM by Hagen-Roderich »

Offline Nicky

  • Administrator
  • 4images Guru
  • *****
  • Posts: 3.195
    • View Profile
Re: [Mod] Display random images on homepage, if no new images
« Reply #32 on: January 31, 2010, 11:12:21 PM »
change
Code: [Select]
       FROM ".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c
to

Code: [Select]
       FROM (".IMAGES_TABLE." i,  ".CATEGORIES_TABLE." c)
.. look now...
cheers
Nicky
Your first three "must do" before you ask a question ! (© by V@no)
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

nicky.net 4 4images
Signature stolen from mawenzi

Offline Hagen-Roderich

  • Full Member
  • ***
  • Posts: 127
    • View Profile
    • Hof Jokers
Re: [Mod] Display random images on homepage, if no new images
« Reply #33 on: February 01, 2010, 07:58:49 PM »
Thank you works perfectly.

Next question:
How to make "Neue Bilder" only be showed if there are new images?
« Last Edit: February 01, 2010, 08:10:19 PM by Hagen-Roderich »

Offline arabcine

  • Jr. Member
  • **
  • Posts: 87
    • View Profile
Re: [Mod] Display random images on homepage, if no new images
« Reply #34 on: June 02, 2010, 10:03:52 PM »
this work
http://www.4homepages.de/forum/index.php?topic=4010.msg64771#msg64771


but it's show to me 4 images how i can set it 6 pic ?

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline dunyakupasi

  • Newbie
  • *
  • Posts: 12
    • View Profile
    • 2010 dünya kupası
Re: [Mod] Display random images on homepage, if no new images
« Reply #36 on: June 12, 2010, 01:59:45 AM »
This does not work on 1.7.7
Çok büyük bir emeğin ve zamanın ürünü olan euro 2012 ile ilgili haberler, maçlar, stadyumlar, takımlar ve maç sonuçları gibi kategorilerde ayrıntılı bir içeriğe sahip euro 2012 sitemizi ziyaret etmeniz, görüş ve önerilerinizi bildirmeniz bizi mutlu edecektir.


Offline Hagen-Roderich

  • Full Member
  • ***
  • Posts: 127
    • View Profile
    • Hof Jokers
Re: [Mod] Display random images on homepage, if no new images
« Reply #38 on: June 15, 2010, 08:39:47 AM »
This does not work on 1.7.7

Whats your MySQL version, you are useing?

MySQL 5?
If so, try: http://www.4homepages.de/forum/index.php?topic=4010.msg145087#msg145087

Offline MrAndrew

  • Sr. Member
  • ****
  • Posts: 302
    • View Profile
    • Aviation PhotoBase
Re: [Mod] Display random images on homepage, if no new images
« Reply #39 on: July 05, 2011, 06:56:55 PM »
ORDER BY random_no DESCRAND(), i.image_hits DESC

This rondomize my new images sorted by hits "image_hits" query too... How to randomize only random_no???

Offline brez

  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: [Mod] Display random images on homepage, if no new images
« Reply #40 on: November 11, 2011, 06:32:47 PM »
Does not work with 1.7.10

Quote
DB 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, 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.cat_id NOT IN (0) ORDER BY random_no DESC, RAND(), i.image_date DESC LIMIT 8
Unknown column 'random_no' in 'order clause'

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/irishavs/public_html/includes/db_mysql.php on line 116

Rembrandt

  • Guest
Re: [Mod] Display random images on homepage, if no new images
« Reply #41 on: November 11, 2011, 07:06:34 PM »
Does not work with 1.7.10
.....Unknown column 'random_no' in 'order clause'

you have no column 'random_no' in your DB

this works
http://www.4homepages.de/forum/index.php?topic=4010.msg64771#msg64771

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [Mod] Display random images on homepage, if no new images
« Reply #42 on: November 11, 2011, 07:50:04 PM »
Does not work with 1.7.10
It works, you just made a mistake on the first line of the code you were supposed to replace.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline brez

  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: [Mod] Display random images on homepage, if no new images
« Reply #43 on: November 11, 2011, 07:56:17 PM »
Thanks Rembrandt it works alright but......
I had 8 images showing to fill the homepage, now i am reduced to 4 again.

Rembrandt

  • Guest
Re: [Mod] Display random images on homepage, if no new images
« Reply #44 on: November 11, 2011, 08:06:46 PM »
do you want 8 images only on home.html?
search in the code:
LIMIT $num_new_images";

replace:
LIMIT 8";


mfg Andi