[PHP-DEV] Bug #13287 Updated: MySQL, PHP and a random problem

2001-09-14 Thread alberty

ID: 13287
User updated by: [EMAIL PROTECTED]
Reported By: [EMAIL PROTECTED]
Old Status: Feedback
Status: Open
Bug Type: MySQL related
Operating System: i686-pc-linux-gnu
PHP Version: 4.0CVS-2001-09-13
New Comment:

Yes, with
mysql -e select ID from footest order by rand() limit 8;

the same problem.

okay, i post it to the mysql dev. forum.

Regards,

-- 
Steve



Previous Comments:


[2001-09-13 13:48:29] [EMAIL PROTECTED]

i guess it's timing-related (and definetly on the MySQL side)

what happens if you call

mysql ... -e select ID from footest order by rand() limit 8;

from command line several times instead of typing the query into the same client 
multiple times?

my first guess would be that you get similar not-so-random results as the RAND() 
result seems to be related to MySQL client runtime somehow ...



[2001-09-13 12:31:08] [EMAIL PROTECTED]

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=6;$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 this bug report at http://bugs.php.net/?id=13287edit=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]




[PHP-DEV] Bug #13287 Updated: MySQL, PHP and a random problem

2001-09-14 Thread derick

ID: 13287
Updated by: derick
Reported By: [EMAIL PROTECTED]
Old Status: Open
Status: Closed
Bug Type: MySQL related
Operating System: i686-pc-linux-gnu
PHP Version: 4.0CVS-2001-09-13
New Comment:

Not a bug in PHP, but in MySQl. Closing

Previous Comments:


[2001-09-14 04:36:35] [EMAIL PROTECTED]

Yes, with
mysql -e select ID from footest order by rand() limit 8;

the same problem.

okay, i post it to the mysql dev. forum.

Regards,

-- 
Steve





[2001-09-13 13:48:29] [EMAIL PROTECTED]

i guess it's timing-related (and definetly on the MySQL side)

what happens if you call

mysql ... -e select ID from footest order by rand() limit 8;

from command line several times instead of typing the query into the same client 
multiple times?

my first guess would be that you get similar not-so-random results as the RAND() 
result seems to be related to MySQL client runtime somehow ...



[2001-09-13 12:31:08] [EMAIL PROTECTED]

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=6;$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 this bug report at http://bugs.php.net/?id=13287edit=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]




[PHP-DEV] Bug #13287 Updated: MySQL, PHP and a random problem

2001-09-13 Thread hholzgra

ID: 13287
Updated by: hholzgra
Reported By: [EMAIL PROTECTED]
Old Status: Open
Status: Feedback
Bug Type: MySQL related
Operating System: i686-pc-linux-gnu
PHP Version: 4.0CVS-2001-09-13
New Comment:

i guess it's timing-related (and definetly on the MySQL side)

what happens if you call

mysql ... -e select ID from footest order by rand() limit 8;

from command line several times instead of typing the query into the same client 
multiple times?

my first guess would be that you get similar not-so-random results as the RAND() 
result seems to be related to MySQL client runtime somehow ...

Previous Comments:


[2001-09-13 12:31:08] [EMAIL PROTECTED]

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=6;$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 this bug report at http://bugs.php.net/?id=13287edit=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]