List Info

Thread: note 78081 added to function.file




note 78081 added to function.file
user name
2007-09-27 00:43:04
"heres a little script to return a random quote from a
quotes file.

<?php
$textfile = "Includes/Quotes.txt";      //quotes
file
if ($quotes = file("$textfile")) {     //don't
display errors on file open
   $quote = rand(0, sizeof($quotes)-1);
   echo $quotes[$quote];                //echo a random
quote
}else{
   echo ("default quote");           //if quotes
file wasn't found, echo out a default quote
}
?> "
I tried this code but there was on thing wrong with it
here is what i did and it works great
I removed the Includes/ thing
and now it works.
<?php
$textfile = "Quotes.txt";      //quotes file
if ($quotes = file("$textfile")) {     //don't
display errors on file open
   $quote = rand(0, sizeof($quotes)-1);
   echo $quotes[$quote];                //echo a random
quote
}else{
   echo ("default quote");           //if quotes
file wasn't found, echo out a default quote
}
?>
----
Server IP: 69.147.83.197
Probable Submitter: 74.221.40.191
----
Manual Page -- http:/
/www.php.net/manual/en/function.file.php
Edit        -- https://master
.php.net/note/edit/78081
Del: integrated  -- h
ttps://master.php.net/note/delete/78081/integrated
Del: useless     -- http
s://master.php.net/note/delete/78081/useless
Del: bad code    -- htt
ps://master.php.net/note/delete/78081/bad+code
Del: spam        -- https:/
/master.php.net/note/delete/78081/spam
Del: non-english -- 
https://master.php.net/note/delete/78081/non-english
Del: in docs     -- http
s://master.php.net/note/delete/78081/in+docs
Del: other reasons-- https://mast
er.php.net/note/delete/78081
Reject      -- https://mast
er.php.net/note/reject/78081
Search      -- https://
master.php.net/manage/user-notes.php

-- 
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php


note 78081 deleted from function.file by bjori
user name
2007-09-27 07:27:31
Note Submitter: pehden  at  yahoo  dot com 

----

"heres a little script to return a random quote from a
quotes file.

<?php
$textfile = "Includes/Quotes.txt";      //quotes
file
if ($quotes = file("$textfile")) {     //don't
display errors on file open
   $quote = rand(0, sizeof($quotes)-1);
   echo $quotes[$quote];                //echo a random
quote
}else{
   echo ("default quote");           //if quotes
file wasn't found, echo out a default quote
}
?> "
I tried this code but there was on thing wrong with it
here is what i did and it works great
I removed the Includes/ thing
and now it works.
<?php
$textfile = "Quotes.txt";      //quotes file
if ($quotes = file("$textfile")) {     //don't
display errors on file open
   $quote = rand(0, sizeof($quotes)-1);
   echo $quotes[$quote];                //echo a random
quote
}else{
   echo ("default quote");           //if quotes
file wasn't found, echo out a default quote
}
?>

-- 
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php


[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )