PDA

View Full Version : Random text/html...


laars
June 15th, 2007, 06:08 PM
I need the same thing as kenzie did here (http://www.myspacepros.com/forum/showthread.php?t=7213), but I want a PHP script to pull either a random txt file or a random line from a single txt file.

GreenSpeed21
June 15th, 2007, 06:19 PM
PM me the texts you want.

laars
June 15th, 2007, 06:20 PM
I don't have them yet. I want to be able to add them, like a random graphic.

SlickEddie
June 15th, 2007, 06:23 PM
you should use mysql

select quote from quotes_table order by rand() limit 1

laars
June 15th, 2007, 06:27 PM
WOAH!
the only thing I know about mysql is how to create the database for a script to do its business. ROFL

SlickEddie
June 15th, 2007, 06:31 PM
can you create a table in mysql?

deep
June 15th, 2007, 06:32 PM
how many images you want to rotate?
mysql for a small number of images to rotate is useless and waste of time!

GreenSpeed21
June 15th, 2007, 07:00 PM
<SCRIPT LANGUAGE="JAVASCRIPT">
var r_text = new Array ();
r_text[0] = "Message 0";
r_text[1] = "Message 1";
r_text[2] = "Message 2";
r_text[3] = "Message 3";
r_text[4] = "Message 4";
r_text[5] = "Message 5";


var i = Math.round(5*Math.random());

document.write("<b>");
document.write(r_text[i]);
document.write("</b>");

</SCRIPT>

Is that good?

GreenSpeed21
June 15th, 2007, 07:02 PM
If you want a php one, it's gona take me more time, but I can make it if you want.

laars
June 15th, 2007, 07:09 PM
yep, thats great! THANKS!

SlickEddie
June 15th, 2007, 07:11 PM
he wants to draw it from a text file (i assume one quote per line)...or he wants to grab a text file from a directory.

if you're going to do this, it would be better to use mysql from a management perspective. If you don't know how to script mysql, then you'll need someone to do it for you.

yes, if we're talking about 5 images, then yeah, mysql is overkill

GreenSpeed21
June 15th, 2007, 07:21 PM
I think we're forgetting something... *Cough* Rep. :batman: