RE: [PHP] 2 conditions why wont they work??
| From: | Matthew Clark | Date: | Mon, 11 Feb 2002 03:46:30 +0000 |
| Subject: | RE: [PHP] 2 conditions why wont they work?? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-84218@lists.php.net to get a copy of this message | ||
In your code below, mysql will throw an error if $clientID is empty or
non-numeric because it is not surrounded with quotation marks.. mysql will
treat it as a field name (or just throw a syntax error if it's empty).
-----Original Message-----
From: Brad Wright [mailto:bradwright@optushome.com.au]
Sent: 11 February 2002 03:45
To: Bogdan Stancescu
Cc: PHP General List
Subject: Re: [PHP] 2 conditions why wont they work??
Thanks,
$clientID is a string but is not empty...already tried echo($clientID) and
it is not empty.
Did you mean that if the value of $cientID is a string it wont work????
Thanks
Brad
> From: Bogdan Stancescu <mgv@fx.ro>
> Date: Mon, 11 Feb 2002 05:38:31 +0200
> To: Brad Wright <bradwright@optushome.com.au>
> Cc: PHP General List <php-general@lists.php.net>
> Subject: Re: [PHP] 2 conditions why wont they work??
>
> Do an echo($clientID) before - it most probably is either empty or it's a
> string and MySQL actually issues errors there.
>
> Bogdan
>
> Brad Wright wrote:
>
>> Hi all,
>> Im was sure you could select a row from a mySQL database based on 2
>> conditions. My code:
>>
>> $query2 = "select * from Table where userNo = $userNo and clientID =
>> $clientID";
>> $result2 = mysql_query($query2,$db);
>>
>> This returns :
>> Warning: Supplied argument is not a valid MySQL result resource
>>
>> b ut if i change the line to:
>> $query2 = "select * from Table where userNo = $userNo;
>> $result2 = mysql_query($query2,$db);
>>
>> it works (but get all the rows with userNo = $userNo.
>>
>> HELP!!!! Im sure this should work...what am i doing wrong???
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php