From: [EMAIL PROTECTED]
Operating system: i686-pc-linux-gnu
PHP version: 4.0CVS-2001-09-13
PHP Bug Type: MySQL related
Bug description: MySQL, PHP and a random problem
Hi,
i have found a mystic behavior with
MySQL and PHP.
The follow code describes a problem which i have
only observe in the combination between PHP and MySQL.
i have test it with PHP (406,407dev,408dev) and
MySQL (3.23.39-3.23.42) under suse-linux.
okay, lets go to the problem.
First make a simple table like:
// SQL-Dump
CREATE TABLE footest (
ID int(10) unsigned NOT NULL default '0',
KEY ID (ID)
) TYPE=MyISAM;
then push many rows in the table with increasing numbers!
<?php
for ($i=1;$i<=60000;$i++){
mysql_query("insert into footest (ID) values($i)");
}
?>
okay, and now the miracle comes with this script:
<?php
$result=mysql_query("select ID from footest order by rand() limit 8");
if ($result!=false) while ($tmp=mysql_fetch_assoc($result)){
echo $tmp['ID']."<br>";
}
else echo mysql_error();
?>
i have attached 5 series from the little code:
Call 1: 52839,36271, 2555,42892,32471,13967,52990,27917
Call 2: 52823,36255, 2539,42876,32455,13951,52974,27901
Call 3: 52775,36207, 2491,42828,32407,13903,52926,27853
Call 4: 52751,36183, 2467,42804,32383,13879,52902,27829
Call 5: 52735,36167, 2451,42788,32367,13863,52886,27813
you see the problem ? No, okay make the same test under
the mysql console.
Type:
"select ID from footest order by rand() limit 8;"
and mysql results really random rows. strange problem ;-)
i hope some developer have an idea, where the problem is, but
perhaps it is a mysql problem.
Regards,
--
Steve
--
Edit bug report at: http://bugs.php.net/?id=13287&edit=1
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]