|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2001-09-13 13:48 UTC] hholzgra@php.net
[2001-09-14 04:36 UTC] alberty at neptunlabs dot de
[2001-09-14 04:55 UTC] derick@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 00:00:02 2025 UTC |
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