Re: [PHP] Re: using rand()

2005-04-08 Thread Richard Lynch
On Fri, April 8, 2005 7:41 am, kyriacos sakkas said: > first I would suggest you get the largest value from the auto increment > field (maybe use last_insert_id()). Then use rand(1,$cno_max) three > times to get three random cno numbers, then "select ... from ... where > cno=$val1 or cno=$val2 or c

Re: [PHP] Re: using rand()

2005-04-08 Thread Ryan A
I guess so, but I dont think the difference would be all that great using rand() in php or "order by rand" in mysql.. worth checking up for "programmer show off" rights anyway :-) Cheers, Ryan > i guess a good question would be which one of these methods has more > > overhead - having php calcul

Re: [PHP] Re: using rand()

2005-04-08 Thread Drewcore
i guess a good question would be which one of these methods has more overhead - having php calculate the random numbers for queries, or having the mysql db pick them at random itself? i don't really focus that much on optimization, but if you expect heavy traffic on your site, it might be in your b