Random picture!

Started on the old forum in June 2009 · view the original in the archive · old links redirect here

10 replies · 1,107 views · started 17 years ago · 1 min read

6 participants
Guest #1

I need random 5 photo gallery code for lavalair wml version.. Please coders help me with this code.. Thanks

Pablo Developer · 164 posts #2

its already posted

riderz Lead · 975 posts #3

please share the code in user profile to see 5 pics of the sertain user please


Jacques jacques@gw-designs.co.za http://coding.biz.tm Come join and lets make it a place to learn all the noobies how to code


NEVER FORGET TO CLICK THE TANX BUTTON IF U LIKE WHAT IM SHARING OR HELPING WITH

riderz Lead · 975 posts #4

guys i have this code how can i change the random image to a one user pic

$user = getnick_uid($pic[0]);
$pic = mysql_fetch_array(mysql_query("SELECT uid, imageurl FROM ibwf_usergallery ORDER BY RAND() LIMIT 1"));
$user = getnick_uid($pic[0]);
$user = getnick_uid($pic[0]);
echo "<a href=\"gallery2.php?action=viewuser&sid=$sid&who=$pic[0]\"/><img src=\"$pic[1]\" width=\"30\" height=\"30\"/></a>";
$pic = mysql_fetch_array(mysql_query("SELECT uid, imageurl FROM ibwf_usergallery ORDER BY RAND() LIMIT 1"));
$user = getnick_uid($pic[0]);
echo "<a href=\"index.php?action=viewuser&sid=$sid&who=$pic[0]\"/><img src=\"$pic[1]\" width=\"30\" height=\"30\"/></a>";
$pic = mysql_fetch_array(mysql_query("SELECT uid, imageurl FROM ibwf_usergallery ORDER BY RAND() LIMIT 1"));
$user = getnick_uid($pic[0]);
echo "<a href=\"index.php?action=viewuser&sid=$sid&who=$pic[0]\"/><img src=\"$pic[1]\" width=\"30\" height=\"30\"/></a>";
$pic = mysql_fetch_array(mysql_query("SELECT uid, imageurl FROM ibwf_usergallery ORDER BY RAND() LIMIT 1"));
$user = getnick_uid($pic[0]);
echo "<a href=\"index.php?action=viewuser&sid=$sid&who=$pic[0]\"/><img src=\"$pic[1]\" width=\"30\" height=\"30\"/></a>";
$pic = mysql_fetch_array(mysql_query("SELECT uid, imageurl FROM ibwf_usergallery ORDER BY RAND() LIMIT 1"));
$user = getnick_uid($pic[0]);
echo "<a href=\"index.php?action=viewuser&sid=$sid&who=$pic[0]\"/><img src=\"$pic[1]\" width=\"30\" height=\"30\"/></a>";

Jacques jacques@gw-designs.co.za http://coding.biz.tm Come join and lets make it a place to learn all the noobies how to code


NEVER FORGET TO CLICK THE TANX BUTTON IF U LIKE WHAT IM SHARING OR HELPING WITH

godzilla Developer · 119 posts #5

Ghetto888 wrote: I need random 5 photo gallery code for lavalair wml version.. Please coders help me with this code.. Thanks

use this.

if u have other sql of gallery then change according to it

echo "<br/><b><u><i>Random Image:</i></u></b><br/>";
$sql=mysql_fetch_array(mysql_query("SELECT uid, itemurl  FROM fun_gallery ORDER BY RAND() LIMIT 1"));
$nick = getnick_uid($sql[0]);
echo "<img src=\"$sql[1]\" alt=\"$sql[0]\"/><br/><a href=\"index.php?action=viewuser&who=$sql[0]&sid=$sid\">$nick</a><br/>-----<br/>";
Guest #6

Thanks, 🙂))

godzilla Developer · 119 posts #7

if u want five random gallery photo then change its limit from 1 to 5

ori Lead · 512 posts #8

i use

$query=query("*",gallery,"type='I' ORDER BY RAND() LIMIT 5");
if(mysql_num_rows($query)>0){
while($row=mysql_fetch_array($query)){
$user=UserFromId($row['uid']);
$random.="<img src=\"/phpThumb/phpThumb.php?src=$row[path]&h=50&f=gif\" alt=\"$user\"/>\n";
}
}
ak0ztik Newbie · 4 posts #9

any0ne here wh0 c0uld help me make a new wapsite? 0ur server c0.cc bugged d0wn..im a newbie..help me pls..

godzilla Developer · 119 posts #10

here is wml gallery

with sql

use this ghetto

-- --------------------------------------------------------

--
-- Table structure for table `fun_galcomments`
--

CREATE TABLE IF NOT EXISTS `fun_galcomments` (
  `id` int(99) NOT NULL auto_increment,
  `pid` int(99) NOT NULL default '0',
  `text` varchar(200) NOT NULL default '',
  `byuser` varchar(100) NOT NULL default '',
  `time` varchar(99) NOT NULL default '',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `text` (`text`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=47 ;

--
-- Dumping data for table `fun_galcomments`
--

-- --------------------------------------------------------

--
-- Table structure for table `fun_gallery`
--

CREATE TABLE IF NOT EXISTS `fun_gallery` (
  `id` int(100) NOT NULL auto_increment,
  `uid` int(100) NOT NULL default '0',
  `sex` varchar(255) NOT NULL default '',
  `itemurl` varchar(255) NOT NULL default '',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `name` (`itemurl`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=196 ;

--
-- Dumping data for table `fun_gallery`
--

-- --------------------------------------------------------

--
-- Table structure for table `fun_prate`
--

CREATE TABLE IF NOT EXISTS `fun_prate` (
  `id` int(100) NOT NULL auto_increment,
  `pid` int(100) NOT NULL default '0',
  `uid` int(100) NOT NULL default '0',
  `prate` char(1) NOT NULL default '',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

--
-- Dumping data for table `fun_prate`
--

-- --------------------------------------------------------

--
-- Table structure for table `gallery`
--

CREATE TABLE IF NOT EXISTS `gallery` (
  `id` int(100) NOT NULL auto_increment,
  `uid` varchar(100) NOT NULL default '',
  `file` varchar(250) NOT NULL default '',
  `sex` char(1) NOT NULL default '',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

--
-- Dumping data for table `gallery`
--
Attachments: gallery.zip
JoEsaR Junior · 28 posts #11

echo " Random Image: "; $sql=mysql_fetch_array(mysql_query("SELECT uid, itemurl FROM fun_gallery ORDER BY RAND() LIMIT 1")); $nick = getnick_uid($sql[0]); echo "<img src="$sql[1]" alt="$sql[0]"/> <a href="index.php?action=viewuser&who=$sql[0]&sid=$sid">$nick</a>

";

LIMIT 1 is not working.it still show 1 picture if we chang to LIMIT 4, LIMIT 5 or LIMIT 6 anybody have the answer?

Write your reply now; next you create a free account (or sign in) and it is posted right away. Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close