Random Pic Block
#2
Posted 06 December 2005 - 10:28 AM
BPNation, on Dec 2 2005, 05:51 PM, said:
I don't have unreal gallery, so I can't make it. If you can make me an admin on your site with the ability to use the sql toolbox, then I can look at the structure of the table for the gallery and create a block for you.
Edited by cricket, 06 December 2005 - 10:28 AM.
#4
Posted 01 January 2006 - 03:27 PM
Hottt, on Dec 13 2005, 03:31 AM, said:
try this code (not mine, can't recall who the author is) . Make sure you change the bold to reflect your site
<?php
echo('<CENTER><TABLE BORDER=0><TR>');
$MZresult = @mysql_query("SELECT ibf_gallery_images.id as picid,ibf_members.name as mname,`masked_file_name`,`directory`,`caption`
FROM `ibf_gallery_images` , `ibf_members`
WHERE ibf_gallery_images.member_id = ibf_members.id and ibf_gallery_images.approved=1
ORDER BY rand()
LIMIT 1");
while ( $MZrow = mysql_fetch_array($MZresult) ) {
echo('<TD ALIGN=CENTER width=99%><a href="../forum/index.php?act=module&module=gallery&cmd=si&img='.$MZrow['picid'].'">');
echo('<B>'.$MZrow['caption'].'</B><BR><IMG SRC="../forum/uploads/');
echo($MZrow['directory']. '/tn_'.$MZrow['masked_file_name'].'" alt="click HERE more info on the image"'. 'border=0 ><BR>by '.$MZrow['mname'].'</TD>');
echo ('</TR><TR>');
}
echo('</TR></TABLE>');
?>
#5
Posted 12 January 2006 - 07:57 AM
When i try to add a block with that code i get this:
mySQL query error: UPDATE ibf_up_custcontent SET html='<?php
echo('<CENTER><TABLE BORDER=0><TR>');
$MZresult = @mysql_query("SELECT ibf_gallery_images.id as picid,ibf_members.name as mname,`masked_file_name`,`directory`,`caption`
FROM `ibf_gallery_images` , `ibf_members`
WHERE ibf_gallery_images.member_id = ibf_members.id and ibf_gallery_images.approved=1
ORDER BY rand()
LIMIT 1");
while ( $MZrow = mysql_fetch_array($MZresult) ) {
echo('<TD ALIGN=CENTER width=99%><a href="http://kulabu.ru/index.php?act=module&module=gallery&cmd=si&img='.$MZrow['picid'].'">');
echo('<B>'.$MZrow['caption'].'</B><BR><IMG SRC="http://kulabu.ru/photos/1120819310/');
echo($MZrow['directory']. '/tn_'.$MZrow['masked_file_name'].'" alt="click HERE more info on the image"'. 'border=0 ><BR>by '.$MZrow['mname'].'</TD>');
echo ('</TR><TR>');
}
echo('</TR></TABLE>');
?>' WHERE name='photos'
SQL error: 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 '><TABLE BORDER=0><TR>');
$MZresult = @mysql_query("SELECT ibf_
SQL error code:
Date: Thursday 12th of January 2006 04:56:32 PM
What's wrong?
Thank you!
#8
Posted 25 January 2006 - 11:10 PM
CT
[quote name='Hottt' post='677' date='Jan 12 2006, 08:57 AM']
Hi!
When i try to add a block with that code i get this:
mySQL query error: UPDATE ibf_up_custcontent SET html='<?php
echo('<CENTER><TABLE BORDER=0><TR>');
$MZresult = @mysql_query("SELECT ibf_gallery_images.id as picid,ibf_members.name as mname,`masked_file_name`,`directory`,`caption`
FROM `ibf_gallery_images` , `ibf_members`
WHERE ibf_gallery_images.member_id = ibf_members.id and ibf_gallery_images.approved=1
ORDER BY rand()
LIMIT 1");
while ( $MZrow = mysql_fetch_array($MZresult) ) {
echo('<TD ALIGN=CENTER width=99%><a href="http://kulabu.ru/index.php?act=module&module=gallery&cmd=si&img='.$MZrow['picid'].'">');
echo('<B>'.$MZrow['caption'].'</B><BR><IMG SRC="http://kulabu.ru/photos/1120819310/');
echo($MZrow['directory']. '/tn_'.$MZrow['masked_file_name'].'" alt="click HERE more info on the image"'. 'border=0 ><BR>by '.$MZrow['mname'].'</TD>');
echo ('</TR><TR>');
}
echo('</TR></TABLE>');
?>' WHERE name='photos'
SQL error: 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 '><TABLE BORDER=0><TR>');
$MZresult = @mysql_query("SELECT ibf_
SQL error code:
Date: Thursday 12th of January 2006 04:56:32 PM
What's wrong?
Thank you!
[/quote]
#10
Posted 19 February 2006 - 09:49 PM
Sysop, on Feb 17 2006, 01:58 AM, said:
Works fine!!
Actually, I should say, I had to modify the code to make it work on my board. The code I used is;
<?php
echo('<CENTER><TABLE BORDER=0><TR>');
$MZresult = @mysql_query("SELECT ipb_gallery_images.id as picid,ipb_members.name as mname,`masked_file_name`,`directory`,`caption`
FROM `ipb_gallery_images` , `ipb_members`
WHERE ipb_gallery_images.member_id = ipb_members.id
ORDER BY rand()
LIMIT 1");
while ( $MZrow = mysql_fetch_array($MZresult) ) {
echo('<TD ALIGN=CENTER width=99%><a href="../index.php?act=module&module=gallery&cmd=si&img='.$MZrow['picid'].'">');
echo('<B>'.$MZrow['caption'].'</B><BR><IMG SRC="../uploads/');
echo($MZrow['directory']. '/tn_'.$MZrow['masked_file_name'].'" alt="click HERE more info on the image"'. 'border=0 ><BR>by '.$MZrow['mname'].'</TD>');
echo ('</TR><TR>');
}
echo('</TR></TABLE>');
?>
because I don't have my webboard installed in a /forums/ directory.
#13
Posted 11 July 2006 - 07:15 AM
chutieu, on Jan 1 2006, 06:27 PM, said:
<?php
echo('<CENTER><TABLE BORDER=0><TR>');
$MZresult = @mysql_query("SELECT ibf_gallery_images.id as picid,ibf_members.name as mname,`masked_file_name`,`directory`,`caption`
FROM `ibf_gallery_images` , `ibf_members`
WHERE ibf_gallery_images.member_id = ibf_members.id and ibf_gallery_images.approved=1
ORDER BY rand()
LIMIT 1");
while ( $MZrow = mysql_fetch_array($MZresult) ) {
echo('<TD ALIGN=CENTER width=99%><a href="../forum/index.php?act=module&module=gallery&cmd=si&img='.$MZrow['picid'].'">');
echo('<B>'.$MZrow['caption'].'</B><BR><IMG SRC="../forum/uploads/');
echo($MZrow['directory']. '/tn_'.$MZrow['masked_file_name'].'" alt="click HERE more info on the image"'. 'border=0 ><BR>by '.$MZrow['mname'].'</TD>');
echo ('</TR><TR>');
}
echo('</TR></TABLE>');
?>
I used this and it worked Great
Thanks
#14
Posted 23 July 2006 - 09:26 AM
Sysop, on Feb 20 2006, 05:49 AM, said:
<?php
echo('<CENTER><TABLE BORDER=0><TR>');
$MZresult = @mysql_query("SELECT ipb_gallery_images.id as picid,ipb_members.name as mname,`masked_file_name`,`directory`,`caption`
FROM `ipb_gallery_images` , `ipb_members`
WHERE ipb_gallery_images.member_id = ipb_members.id
ORDER BY rand()
LIMIT 1");
while ( $MZrow = mysql_fetch_array($MZresult) ) {
echo('<TD ALIGN=CENTER width=99%><a href="../index.php?act=module&module=gallery&cmd=si&img='.$MZrow['picid'].'">');
echo('<B>'.$MZrow['caption'].'</B><BR><IMG SRC="../uploads/');
echo($MZrow['directory']. '/tn_'.$MZrow['masked_file_name'].'" alt="click HERE more info on the image"'. 'border=0 ><BR>by '.$MZrow['mname'].'</TD>');
echo ('</TR><TR>');
}
echo('</TR></TABLE>');
?>
because I don't have my webboard installed in a /forums/ directory.
This worked fabulously on the site I maintain, I merely substituded the Uploads dir for where my gallery images are stored.
Thank you very muchly!
#15
Posted 27 July 2006 - 06:22 AM
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users












