WHERE problem
- From: thebarmy@xxxxxxxxxxxxxxxxx (Mike Shanley)
- Date: Mon, 19 Feb 2007 15:23:08 -0500
I'd like to think I understood code a little better than this, but I've got a problem with my WHERE...
I know it's the WHERE because I get a good result when I leave it out. And the random function is also working... I honestly can't figure it out. Thanks in advance for help with this laughable prob.
---------------------------
// How many are there?
$result = mysql_query("SELECT count(*) FROM fortunes");
$max = mysql_result($result, 0);
// Get randomized!... the moderated way...
$randi = mt_rand(1, $max-1);
$q = "SELECT text FROM fortunes WHERE index = '$randi'";
$choose = mysql_query($q);
$chosen1 = mysql_fetch_array($choose);
// Ready to ship...
$fortune = '<span class="quotecyc">"' . $chosen1[0] . '"<br/>-Omniversalism.com</span>';
mysql_close();
--
Mike Shanley
~you are almost there~
.
- Follow-Ups:
- Re: [PHP] WHERE problem
- From: Jim Lucas
- Re: WHERE problem
- From: Fergus Gibson
- Re: [PHP] WHERE problem
- References:
- Change in 5.2.1 re. parsing of URL
- From: Lewis Kapell
- Change in 5.2.1 re. parsing of URL
- Prev by Date: RE: [PHP] Catch STDERR
- Next by Date: Re: [PHP] WHERE problem
- Previous by thread: Re: [PHP] Change in 5.2.1 re. parsing of URL
- Next by thread: Re: WHERE problem
- Index(es):