•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 456,552 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,472 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 3816 | Replies: 13
![]() |
•
•
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation:
Rep Power: 8
Solved Threads: 240
if thats the case, why not generate one more random number ?
This will do.. Don't you think ?
php Syntax (Toggle Plain Text)
<?php $arr=array(); for($i=0;$i<7;$i++){ $arr[$i]="./img/images/".$i.".jpg"; } $random=rand(0,6); $random_1=rand(0,6); echo "<img src=".$arr[$random].">"; echo "<img src=".$arr[$random_1].">"; ?>
This will do.. Don't you think ?
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
*PM asking for help will be ignored*
*PM asking for help will be ignored*
•
•
Join Date: Dec 2007
Posts: 2
Reputation:
Rep Power: 0
Solved Threads: 0
that looks like it could do the trick with abit of working... basically....
i want there to be a folder of images... the names of those images could be anything at all.... number letters.. mixtures... there will be no logical order to them..... i just need the code to randomly pick say 10 images... out of that folder... no image being displayed twice etc...
if there isnt enough ... say there is 4 images.. it will just display 4
if there is no images... maybe just a statement showing there is no images to display at this time...
i want there to be a folder of images... the names of those images could be anything at all.... number letters.. mixtures... there will be no logical order to them..... i just need the code to randomly pick say 10 images... out of that folder... no image being displayed twice etc...
if there isnt enough ... say there is 4 images.. it will just display 4
if there is no images... maybe just a statement showing there is no images to display at this time...
•
•
Join Date: Mar 2008
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
•
•
•
•
finished the code; i sent you a private message with the url of the test script
Hi, I am fairly new to web design and am trying to do exactly what you helped the other person on this post do, is there any way I could also get ahold of that code? I would be very grateful. Thanx.
![]() |
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Random Images on Refresh (JavaScript / DHTML / AJAX)
- random images (PHP)
- Implementing Random Images (Java)
- Need help making simple random images (PHP)
- ASP .NET Display Random records from the database (ASP.NET)
- looking for a free or low cost program to randomly display text and/or images (PHP)
Other Threads in the PHP Forum
- Previous Thread: dynamically built webpage for multiple audio and text points.
- Next Thread: PHP Count & Display Question



Linear Mode