homepage Welcome to WebmasterWorld Guest from 50.16.112.199
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Needing help with random images from database.
MostWanted

5+ Year Member



 
Msg#: 3658387 posted 11:22 pm on May 24, 2008 (gmt 0)

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...

 

jatar_k

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



 
Msg#: 3658387 posted 3:00 pm on May 26, 2008 (gmt 0)

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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved