Welcome to WebmasterWorld Guest from 54.167.185.18

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Needing help with random images from database.

   
11:22 pm on May 24, 2008 (gmt 0)

5+ Year Member



I was wondering if someone could help me out real quick, here is the way my images are set up on my database database...
-- Table structure for table `images`
--

CREATE TABLE `images` (
`id` int(99) NOT NULL auto_increment,
`type` varchar(255) NOT NULL default '',
`folder` varchar(255) NOT NULL default '',
`url` varchar(255) NOT NULL default '',
`code` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=14029 DEFAULT CHARSET=utf8 AUTO_INCREMENT=14029 ;

--
-- Dumping data for table `images`
--

INSERT INTO `images` (`id`, `type`, `folder`, `url`, `code`) VALUES (7712, 'Image Dir', 'Sub Dir', 'http://linktoimage', ''),
(3089, 'Image Dir', 'Sub Dir', 'http://linktoimage', ''),

What I am wanting to do is have something setup that I can include into my index that will display a few columns and the linkable images from my site. The images are linked by id...

3:00 pm on May 26, 2008 (gmt 0)

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member



maybe something like

SELECT id FROM images ORDER BY RAND() LIMIT 3

just off the top of my head, didn't try it. Change the limit to change the number of rows returned.