Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Multiple Random Quote ! PHP
Old 12-13-2005, 07:39 AM Multiple Random Quote ! PHP
Uche's Avatar
Extreme Talker

Posts: 174
Location: Nigeria/Lagos
Trades: 0
PHP Code:
 <?php 
$randquotes_file 
file("myquotes.txt"); 
$randquotes rand(0sizeof($randquotes_file)-1); 
$Random_Quote $randquotes_file[$randquotes]; 
echo 
$Random_Quote
?>
guy i want multiple radom how do i add more TXT to the one i have up there.. like that one i have there is just one.. and probably thinking of using an image.. not TXT my question is how do i add more TXT file or image.

Thanks
__________________
Life is just lyke a school where everybody goes to learn one or two thing. the more u school, the more u learn more about school..The more we live our lifes.. the more we learn more about life.

Please login or register to view this content. Registration is FREE
Uche is offline
Reply With Quote
View Public Profile Visit Uche's homepage!
 
 
Register now for full access!
Old 12-13-2005, 02:15 PM
0beron's Avatar
Defies a Status

Posts: 1,832
Location: Somewhere else entirely
Trades: 0
PHP Code:
<?php 
$randquotes_file 
file("myquotes.txt"); 
$randquotes_file array_merge($randquotes_file,file("myquotes2.txt"));
$randquotes_file array_merge($randquotes_file,file("morequotes.txt")); 
$randquotes_file array_merge($randquotes_file,file("yetmorequotes.txt")); 
$randquotes rand(0sizeof($randquotes_file)-1); 
$Random_Quote $randquotes_file[$randquotes]; 
echo 
$Random_Quote
?>
That should allow you to source the quotes from multiple text files. If you want to display random images then you can either fill the text files with the image filenames and then echo out <img> tags around the filenames, or you can get rid of the text files and use the PHP directory functions to list the files in the image directory and pick one randomly to display.
__________________
UPDATE 0beron SET talkupation = talkupation + lots WHERE post = 'helpful';

Please login or register to view this content. Registration is FREE
(aka MSN handwriting for forums)
0beron is offline
Reply With Quote
View Public Profile Visit 0beron's homepage!
 
Reply     « Reply to Multiple Random Quote ! PHP
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.30408 seconds with 12 queries