sub getquotes { $rand = int(rand(6)); switch($rand){ case 0 { $ob = "ORDER BY id ASC"; } case 1 { $ob = "ORDER BY name DESC"; } case 2 { $ob = "ORDER BY quote ASC"; } case 3 { $ob = "ORDER BY id DESC"; } case 4 { $ob = "ORDER BY name ASC"; } case 5 { $ob = "ORDER BY quote DESC"; } else { $ob = null; } } $d="main";$u="root";$p="rootwdp";$h="localhost";$db=DBI->connect("DBI:mysql:$d:$h",$u,$p); if ($ob){ $query=$db->prepare("SELECT * FROM quotes ".$ob); } else { $query=$db->prepare("SELECT * FROM quotes ORDER BY id ASC"); } my $count=-1; while (@array = $query->fetchrow_array) { ($id, $name, $quote) = @array; $count++; print "fader[2].message[".$count."]=\""".$quote.""
- ".$name."\";"; } }