Ok, good advice Xenon, thanks! My strategy will now be to count rows, and generate a random int between 1 and max_rows, and then do a SELECT by that random ID, grabbing the quote text.
My next challenge is importing my text file of quotes. Each quote is separated by a newline character (\n). I created a table with a primary ID of type int(11), and a longtext field. I'm having difficulty importing it by means of phpmyadmin, because the ID field is chomping off the first 11 characters of each quote as it tries to fill the auto_completing primary field. Annoying!
I may have to go into Excel and add a prefixing column 11 characters wide.
|