WHERE id > 0
would take care of that.
Or, better yet, SEPARETE your 'id' field from your 'approved' field
and don't try to be cheap with a one-byte (or even one-bit in some
DBs) field.
Over-loading the data field definition with dual meaning almost always
turns into a problem down the line, in m
On Tue, February 20, 2007 10:46 am, Németh Zoltán wrote:
> 2007. 02. 20, kedd keltezéssel 11.39-kor
> [EMAIL PROTECTED]
> ezt Ãrta:
>> Different strokes for different folks...
>>
>> Might I toss a new recommendation into the mix?
>>
>> SELECT text FROM fortunes ORDER BY RAND() LIMIT 1;
>>
>
> tha
On Mon, February 19, 2007 2:32 pm, Bruce Cowin wrote:
Mike Shanley <[EMAIL PROTECTED]> 20/02/2007 9:23:08 a.m.
>>>
> 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 leav
The reason I didn't go with the suggestions for this approach is that I
want to accept new submissions to the database whose default id = 0.
Thus, I can moderate them on the way in by giving them non-0 numbers.
(I've changed the database row count call to fit the implementation
since my posting
Ah.. sorry Jay. I had like 8,000 emails today and must have missed some of the
original responses.
Or maybe I'm just trying to look smart by riding on your coat-tails. Either
way, apologies for the repeated information.
-TG
= = = Original message = = =
[snip]
Different strokes for different
2007. 02. 20, kedd keltezéssel 11.39-kor [EMAIL PROTECTED]
ezt írta:
> Different strokes for different folks...
>
> Might I toss a new recommendation into the mix?
>
> SELECT text FROM fortunes ORDER BY RAND() LIMIT 1;
>
that's not new :)
a couple of people recommended it earlier today/yesterda
[snip]
Different strokes for different folks...
Might I toss a new recommendation into the mix?
SELECT text FROM fortunes ORDER BY RAND() LIMIT 1;
[/snip]
I suggested that yesterday. :)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Different strokes for different folks...
Might I toss a new recommendation into the mix?
SELECT text FROM fortunes ORDER BY RAND() LIMIT 1;
= = = Original message = = =
N~~meth Zolt~~n wrote:
> 2007. 02. 20, kedd keltez~~ssel 08.17-kor Jim Lucas ezt ~~rta:
>> Mike Shanley wrote:
>>> I'd like
2007. 02. 20, kedd keltezéssel 08.28-kor Jim Lucas ezt írta:
> Németh Zoltán wrote:
> > 2007. 02. 20, kedd keltezéssel 08.17-kor Jim Lucas ezt írta:
> >> Mike Shanley wrote:
> >>> I'd like to think I understood code a little better than this, but I've
> >>> got a problem with my WHERE...
> >>>
> >
Németh Zoltán wrote:
2007. 02. 20, kedd keltezéssel 08.17-kor Jim Lucas ezt írta:
Mike Shanley wrote:
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 f
Németh Zoltán wrote:
2007. 02. 20, kedd keltezéssel 08.17-kor Jim Lucas ezt írta:
Mike Shanley wrote:
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 f
2007. 02. 20, kedd keltezéssel 08.17-kor Jim Lucas ezt írta:
> Mike Shanley wrote:
> > 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 func
Mike Shanley wrote:
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 he
This was the problem. Thanks very much!
Brad Fuller wrote:
2) INDEX is a mysql keyword. Try putting backticks around it.
"... WHERE `index` = $randi"
--
Mike Shanley
~you are almost there~
"A new eye opens on March 5." -Omniversalism.com
--
PHP General Mailing List (http://ww
[snip]
// 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);
[/snip]
Put the random statement in the query
SELECT foo FROM bar ORDER BY RAND() LIMIT 1
--
> -Original Message-
> From: Mike Shanley [mailto:[EMAIL PROTECTED]
> Sent: Monday, February 19, 2007 3:50 PM
> Cc: php-general@lists.php.net
> Subject: Re: [PHP] WHERE problem
>
> Without the single-quotes, I still get nothing returned.
>
> Bruce Cowin wr
Without the single-quotes, I still get nothing returned.
Bruce Cowin wrote:
Are you getting an error or just nothing returned? The first thing I'd check
is if index is a numeric field and if it is, remove the single quotes from
around $randi in the where clause.
Regards,
Bruce
Mike S
Are you getting an error or just nothing returned? The first thing I'd check
is if index is a numeric field and if it is, remove the single quotes from
around $randi in the where clause.
Regards,
Bruce
>>> Mike Shanley <[EMAIL PROTECTED]> 20/02/2007 9:23:08 a.m. >>>
I'd like to think I unde
18 matches
Mail list logo