At 16:47 -0200 1/21/03, Valdir Stiebe Junior wrote:
 > I don't know why it returns the first two rows, but (assuming you didn't
 really end your query with two question marks) what error are you
expecting
 to occur?
I didn't end my query with the two question marks. :)
And if i put 0 instead of (2 or any different of zero) after the equal sign
the sql return nothing. (better than returning garbage)
I was expecting something like 'Column NAME isn't of type integer'.
That won't happen. MySQL performs extensive type conversion of values,
attempting to execute the query in the most sensible way given what you
provide.

I'm stlll surprised that NAME = 2 returns anything.  When I tried your
example, it returned no rows.  I get two rows with NAME = 0, nothing
with NAME = 2.  Are you sure you're not mixing up your test results?

NAME = 0 is a string-to-number conversion.  MySQL converts the string
to a number and performs a numeric comparison.  Of your three values,
'ppl1' and 'ppl2' will be converted to 0 (which compares the same as 0),
but NULL is still NULL (which does not compare the same as 0).

If you're getting two rows with NAME = 2 and nothing with NAME = 0,
I'm at a loss to explain it.

---------------------------------------------------------------------
Before posting, please check:
  http://www.mysql.com/manual.php   (the manual)
  http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to