RE: [PHP] random?

From: Date: Thu, 29 Jan 2004 16:07:56 +0000
Subject: RE: [PHP] random?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-176222@lists.php.net to get a copy of this message
Hi Rob, Thanks for the idea....I think it is probably a better way to go also. Hers what I came up iwth...and the rest of the code pertaining to the goal. I'm sure that I'm, overlooking something simple here, but I can't seem to make this work... srand ((double) microtime() * 1000000); $r = mysql_query('select count(*) as cnt from agentdb'); $cnt = mysql_result($r, 0, 0); mysql_free_result($r); $rnd = rand(1, $cnt); $sql = "SELECT * FROM agentdb WHERE ((OfficeID <> 214) and (agentdb.agent_id<> 1115421) and (agentdb.agent_id > 100) and agentdb.agent_id <> 333)) LIMIT $rnd, 1"; $results= mysql_query($sql); $agent=mysql_fetch_array($results); $agent_ref = $agent['agent_ref']; $agent_id = $agent['agent_id']; $agent_first = $agent['agent_first']; $agent_last = $agent['agent_last']; $agent_first = rawurldecode($agent_first); $agent_last = rawurldecode($agent_last);

« previous php.general (#176222) next »