Re: [PHP] 2 conditions why wont they work??

2002-02-10 Thread Bogdan Stancescu

Most unusual indeed. The quick/ugly solution is to trim() the incoming $clientID.
But that's not appropriate if you expect valid entries starting with a space (well,
two spaces in your case) :)

Gotta hit the sack now - check out the time over here! :)

Bogdan

Brad Wright wrote:

> Bogdan,
> It appears that $clientID is saved with a space at the start .. when i check
> for its value (using session_encode() ) it gives that value " test 3" when
> it should be "test 3".
>
> ">
>
> this is the extract form the form on the previous page which sets $clientID.
>
> I am sure that a space is being added but cant find where.
>
> Thanks for yr help,
> Brad


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] 2 conditions why wont they work??

2002-02-10 Thread Brad Wright

Bogdan,
It appears that $clientID is saved with a space at the start .. when i check
for its value (using session_encode() ) it gives that value " test 3" when
it should be "test 3".


">


this is the extract form the form on the previous page which sets $clientID.

I am sure that a space is being added but cant find where.

Thanks for yr help,
Brad
> From: Bogdan Stancescu <[EMAIL PROTECTED]>
> Date: Mon, 11 Feb 2002 05:53:46 +0200
> To: Brad Wright <[EMAIL PROTECTED]>
> Cc: PHP General List <[EMAIL PROTECTED]>
> Subject: Re: [PHP] 2 conditions why wont they work??
> 
> Well, that's probably because of the data - no entries with both conditions
> satisfied... Use "or" if that's what you actually want to do. ;-)
> 
> Bogdan
> 
> Brad Wright wrote:
> 
>> Ahh..that seems to have fixed it. Its now pulling NO data, but is not giving
>> error msg
>> thanks, 1/2 way there now :)
>> 
>> brad
>> 
>>> From: Bogdan Stancescu <[EMAIL PROTECTED]>
>>> Date: Mon, 11 Feb 2002 05:46:46 +0200
>>> To: Brad Wright <[EMAIL PROTECTED]>
>>> Cc: PHP General List <[EMAIL PROTECTED]>
>>> Subject: Re: [PHP] 2 conditions why wont they work??
>>> 
>>> No, with your syntax it won't. You have to quote it in the query, as in
>>> $query2 = "select * from Table where  userNo = $userNo and clientID =
>>> '$clientID'";
>>> 
>>> Bogdan
>>> 
>>> Brad Wright wrote:
>>> 
>>>> 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 <[EMAIL PROTECTED]>
>>>>> Date: Mon, 11 Feb 2002 05:38:31 +0200
>>>>> To: Brad Wright <[EMAIL PROTECTED]>
>>>>> Cc: PHP General List <[EMAIL PROTECTED]>
>>>>> 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
>>> 
>> 
>> --
>> 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




Re: [PHP] 2 conditions why wont they work??

2002-02-10 Thread Bogdan Stancescu

Well, that's probably because of the data - no entries with both conditions
satisfied... Use "or" if that's what you actually want to do. ;-)

Bogdan

Brad Wright wrote:

> Ahh..that seems to have fixed it. Its now pulling NO data, but is not giving
> error msg
> thanks, 1/2 way there now :)
>
> brad
>
> > From: Bogdan Stancescu <[EMAIL PROTECTED]>
> > Date: Mon, 11 Feb 2002 05:46:46 +0200
> > To: Brad Wright <[EMAIL PROTECTED]>
> > Cc: PHP General List <[EMAIL PROTECTED]>
> > Subject: Re: [PHP] 2 conditions why wont they work??
> >
> > No, with your syntax it won't. You have to quote it in the query, as in
> > $query2 = "select * from Table where  userNo = $userNo and clientID =
> > '$clientID'";
> >
> > Bogdan
> >
> > Brad Wright wrote:
> >
> >> 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 <[EMAIL PROTECTED]>
> >>> Date: Mon, 11 Feb 2002 05:38:31 +0200
> >>> To: Brad Wright <[EMAIL PROTECTED]>
> >>> Cc: PHP General List <[EMAIL PROTECTED]>
> >>> 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
> >
>
> --
> 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




RE: [PHP] 2 conditions why wont they work??

2002-02-10 Thread Matthew Clark

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:[EMAIL PROTECTED]]
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 <[EMAIL PROTECTED]>
> Date: Mon, 11 Feb 2002 05:38:31 +0200
> To: Brad Wright <[EMAIL PROTECTED]>
> Cc: PHP General List <[EMAIL PROTECTED]>
> 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


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] 2 conditions why wont they work??

2002-02-10 Thread Brad Wright

Ahh..that seems to have fixed it. Its now pulling NO data, but is not giving
error msg
thanks, 1/2 way there now :)

brad


> From: Bogdan Stancescu <[EMAIL PROTECTED]>
> Date: Mon, 11 Feb 2002 05:46:46 +0200
> To: Brad Wright <[EMAIL PROTECTED]>
> Cc: PHP General List <[EMAIL PROTECTED]>
> Subject: Re: [PHP] 2 conditions why wont they work??
> 
> No, with your syntax it won't. You have to quote it in the query, as in
> $query2 = "select * from Table where  userNo = $userNo and clientID =
> '$clientID'";
> 
> Bogdan
> 
> Brad Wright wrote:
> 
>> 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 <[EMAIL PROTECTED]>
>>> Date: Mon, 11 Feb 2002 05:38:31 +0200
>>> To: Brad Wright <[EMAIL PROTECTED]>
>>> Cc: PHP General List <[EMAIL PROTECTED]>
>>> 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
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] 2 conditions why wont they work??

2002-02-10 Thread Bogdan Stancescu

No, with your syntax it won't. You have to quote it in the query, as in
$query2 = "select * from Table where  userNo = $userNo and clientID =
'$clientID'";

Bogdan

Brad Wright wrote:

> 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 <[EMAIL PROTECTED]>
> > Date: Mon, 11 Feb 2002 05:38:31 +0200
> > To: Brad Wright <[EMAIL PROTECTED]>
> > Cc: PHP General List <[EMAIL PROTECTED]>
> > 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




Re: [PHP] 2 conditions why wont they work??

2002-02-10 Thread Brad Wright

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 <[EMAIL PROTECTED]>
> Date: Mon, 11 Feb 2002 05:38:31 +0200
> To: Brad Wright <[EMAIL PROTECTED]>
> Cc: PHP General List <[EMAIL PROTECTED]>
> 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




RE: [PHP] 2 conditions why wont they work??

2002-02-10 Thread Matthew Clark

Yes - that's most likely the answer.. if the echo doesn't help, try
something like this..

$result2 = mysql_query($query2,$db) or die(mysql_error());

If mysql is throwing up an error, that'll present it too you and stop
execution..



-Original Message-
From: Bogdan Stancescu [mailto:[EMAIL PROTECTED]]
Sent: 11 February 2002 03:39
To: Brad Wright
Cc: PHP General List
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




Re: [PHP] 2 conditions why wont they work??

2002-02-10 Thread Bogdan Stancescu

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