In "showkoan"...
$rth=$dbh->prepare("select max(id) from zen order by id")
or die("Can't connect: ", $dbh->errstr);
$rth->execute;
$id=$rth->fetchrow_array;
$selid=int(rand($id)+1);
$tth=$dbh->prepare("select koan from zen where id=$selid")
or die("Can't connect: ",$dbh->errstr);
$tth->execute;
$koan = $tth->fetchrow_array;
This is the part of the code that I was interested in. I do believe that you can make this much simplier (and faster) with one SQL call:
$tth=$dbh->prepare("select koan from zen order by rand() limit 1")
+
or die("Can't connect: ",$dbh->errstr);
$tth->execute;
$koan = $tth->fetchrow_array;
("order by rand()" is mentioned in chapter 7 of the mysql doc, and I used this trick for a random quote generator of my own.)
Dr. Michael K. Neylon - mneylon-pm@masemware.com
||
"You've left the lens cap of your mind on again, Pinky" - The Brain