Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   PHP (http://www.programmingforums.org/forum29.html)
-   -   Quote Database (http://www.programmingforums.org/showthread.php?t=2416)

aquanius Feb 23rd, 2005 1:20 AM

Quote Database
 
how would you go about doing one? with + and - value increaser like on bash.org

#quote number + - del
QUOTE HERE

like that, and how to do a top 100, random

without using mysql.

Ooble Feb 23rd, 2005 11:00 AM

Why can't you use MySQL or some other database? It'll make it soooooooooooo much easier.

aquanius Feb 23rd, 2005 11:06 AM

my host does not have it.

Ade Feb 23rd, 2005 11:13 AM

which database does your host allow?

Ooble Feb 23rd, 2005 11:16 AM

In that case, I suggest getting a host which does. If that's not an option, you can have a PHP file with an array of quotes, and use the rand() function to pick them randomly.

tempest Feb 23rd, 2005 1:00 PM

Put them all in a file, putting each quote on a new line...

[php]
function getQuote($file) {
$file = implode("", file($file));
$file = explode("\n", $file);
$quoteNum = rand(0, count($file) -1);
return array("number" = >$quoteNum + 1, "quote" => $file[$quoteNum]);
}
[/php]

Example usage:
[php]
$newQuote = getQuote("yourQuotesFile.txt");
echo "Quote #{$newQuote['number']}:<br>\n";
echo "<ul>";
echo $newQuote["quote"];
echo "</ul>";
[/php]

aquanius Feb 23rd, 2005 1:04 PM

my host sucks, no mysql, and I don't really feel like changing.

waht I really need to know is how to do a top 100 and make the + and - and x work.

kurifu Feb 24th, 2005 2:24 PM

You probably need to get a new host, might I suggest http://www.crd-hosting.com - they have mySQL and PHP support and plenty of other goodies at very affordable prices ;)

Ade Feb 25th, 2005 3:54 AM

Quote:

Originally Posted by aquanius
my host sucks, no mysql, and I don't really feel like changing.

Sounds like the American opinion at vote time ;)

My President sucks, no intelligence, and I don't really feel like changing.
:P

Ooble Feb 25th, 2005 6:42 PM

Oooh... you're gonna get beats for that one... :p


All times are GMT -5. The time now is 7:42 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC