newbie PHP/MySQL question
am 03.01.2006 03:18:50 von toylet
------=_Part_18522_24513596.1136254730185
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
A table with a column big5 char(2) not null primary key.
$target->query("delete from canton");
for ($ii=3D0; $ii<256; $ii++) {
for ($jj=3D0; $jj<256; $jj++) {
echo $ii .".". $jj . "\n";
$query=3D"insert into canton ( big5 ) values ( '"
. mysql_real_escape_string(chr($ii).chr($jj))
. "' )";
$target->query($query);
}
}
The program died with this output:
0.92
0.93
0.94
0.95
0.96
0.97
Duplicate entry '' for key 1
The character strings are unique. Why did it find a duplicate at (0,97)?
------=_Part_18522_24513596.1136254730185--
Re: newbie PHP/MySQL question
am 03.01.2006 03:22:40 von Micah Stevens
Maybe from a previous query? I mean, did you make sure the table was clear
before starting the script?
On Monday 02 January 2006 6:18 pm, toylet wrote:
> A table with a column big5 char(2) not null primary key.
>
> $target->query("delete from canton");
> for ($ii=0; $ii<256; $ii++) {
> for ($jj=0; $jj<256; $jj++) {
> echo $ii .".". $jj . "\n";
> $query="insert into canton ( big5 ) values ( '"
> . mysql_real_escape_string(chr($ii).chr($jj))
> . "' )";
> $target->query($query);
> }
> }
>
> The program died with this output:
>
> 0.92
> 0.93
> 0.94
> 0.95
> 0.96
> 0.97
> Duplicate entry '' for key 1
>
> The character strings are unique. Why did it find a duplicate at (0,97)?
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: newbie PHP/MySQL question
am 03.01.2006 12:48:27 von toylet
------=_Part_23696_27346752.1136288907073
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
yes. Note the "delete from canton" query.
I found something. case.. Somehow, mysql treat "A" the same as "a"....
Maybe from a previous query? I mean, did you make sure the table was clear
> before starting the script?
> > $target->query("delete from canton");
> > for ($ii=3D0; $ii<256; $ii++) {
> > for ($jj=3D0; $jj<256; $jj++) {
> > echo $ii .".". $jj . "\n";
> > $query=3D"insert into canton ( big5 ) values ( '"
> > . mysql_real_escape_string(chr($ii).chr($jj))
> > . "' )";
> > $target->query($query);
> > }
> > }
>
------=_Part_23696_27346752.1136288907073--