Aug 7, 2009 7:19 pm
Geoff CoxHello,
I have the following sql line
$query = "select * from codes where " . user_code . "= binary " . "'"
. $result1 . "'" . "&&" . user_password . "= binary " . "'" . $result2
. "'" . "&&" . demo . "='yes'";
which works fine but if I use
. demo . "!='yes'
when a demo field in the mysql table ( varchar / not null) and has
had no value added to it, this does not work.
Can you see why?
Thanks
Geoff
Aug 7, 2009 7:38 pm
Geoff CoxOn Fri, 07 Aug 2009 20:19:29 +0100, Geoff Cox <gcox@freeuk.com> wrote:
>Hello,
>
>I have the following sql line
>
>$query = "select * from codes where " . user_code . "= binary " . "'"
>. $result1 . "'" . "&&" . user_password . "= binary " . "'" . $result2
>. "'" . "&&" . demo . "='yes'";
>
>which works fine but if I use
>
>. demo . "!='yes'
>
>when a demo field in the mysql table ( varchar / not null) and has
>had no value added to it, this does not work.
>
>I have the following sql line
>
>$query = "select * from codes where " . user_code . "= binary " . "'"
>. $result1 . "'" . "&&" . user_password . "= binary " . "'" . $result2
>. "'" . "&&" . demo . "='yes'";
>
>which works fine but if I use
>
>. demo . "!='yes'
>
>when a demo field in the mysql table ( varchar / not null) and has
>had no value added to it, this does not work.
I should have added that if I add 'no' to a demo field then
"='no'
works so cannot see why
"!='yes'
does not work for a demo field with nothing added to it?
Cheers
Geoff
>
>Can you see why?
>
>Thanks
>
>Geoff
>Can you see why?
>
>Thanks
>
>Geoff
Aug 7, 2009 8:13 pm
Doug MillerIn article <08vo75hr2enj0fias04ei0o7serovosgnc@4ax.com>, Geoff Cox <gcox@freeuk.com> wrote:
>Hello,
>
>I have the following sql line
>
>$query = "select * from codes where " . user_code . "= binary " . "'"
>.. $result1 . "'" . "&&" . user_password . "= binary " . "'" . $result2
>.. "'" . "&&" . demo . "='yes'";
>
>which works fine but if I use
>
>.. demo . "!='yes'
>
>when a demo field in the mysql table ( varchar / not null) and has
>had no value added to it, this does not work.
>
>I have the following sql line
>
>$query = "select * from codes where " . user_code . "= binary " . "'"
>.. $result1 . "'" . "&&" . user_password . "= binary " . "'" . $result2
>.. "'" . "&&" . demo . "='yes'";
>
>which works fine but if I use
>
>.. demo . "!='yes'
>
>when a demo field in the mysql table ( varchar / not null) and has
>had no value added to it, this does not work.
I'm not surprised.
>
>Can you see why?
>Can you see why?
The inequality operator in standard SQL is not '!='. It's '<>'.
Aug 7, 2009 9:18 pm
Geoff CoxOn Fri, 07 Aug 2009 20:13:15 GMT, spambait@milmac.com (Doug Miller)
wrote:
>In article <08vo75hr2enj0fias04ei0o7serovosgnc@4ax.com>, Geoff Cox <gcox@freeuk.com> wrote:
>I'm not surprised.
>The inequality operator in standard SQL is not '!='. It's '<>'.
>>Hello,
>>
>>I have the following sql line
>>
>>$query = "select * from codes where " . user_code . "= binary " . "'"
>>.. $result1 . "'" . "&&" . user_password . "= binary " . "'" . $result2
>>.. "'" . "&&" . demo . "='yes'";
>>
>>which works fine but if I use
>>
>>.. demo . "!='yes'
>>
>>when a demo field in the mysql table ( varchar / not null) and has
>>had no value added to it, this does not work.
>>>
>>I have the following sql line
>>
>>$query = "select * from codes where " . user_code . "= binary " . "'"
>>.. $result1 . "'" . "&&" . user_password . "= binary " . "'" . $result2
>>.. "'" . "&&" . demo . "='yes'";
>>
>>which works fine but if I use
>>
>>.. demo . "!='yes'
>>
>>when a demo field in the mysql table ( varchar / not null) and has
>>had no value added to it, this does not work.
>I'm not surprised.
>>
>>Can you see why?
>>>Can you see why?
>The inequality operator in standard SQL is not '!='. It's '<>'.
Thanks for your reply Doug.
I've tried <> and still not working. Also when I use a phpmyadmin
search for not equal the sql shown uses !=. This is the php syntax and
I should have said the sql above is in a php file.
Geoff
Previous Thread: Migrate PHP 2.0 code to PHP 5.x
Next Thread: Looping through an object