Re: Re: socket gives notice on server side(simple newbie code)
| From: | Robert Williams | Date: | Wed, 20 Aug 2014 16:05:37 +0000 |
| Subject: | Re: Re: socket gives notice on server side(simple newbie code) | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-323753@lists.php.net to get a copy of this message | ||
I suspect there's a line-feed character in the input value. Try changing this:
if($stock[$input]!=NULL)
to this:
if($stock[trim($input)]!=NULL)
--
Robert E. Williams, Jr.
Senior Vice President of Software Development
Newtek Businesss Services, Inc. -- The Small Business Authority
https://www.newtekreferrals.com/rewjr
http://www.thesba.com/
On Aug 20, 2014, at 08:09, Jim Giner <jim.giner@albanyhandball.com> wrote:
> On 8/20/2014 11:00 AM, Negin Nickparsa wrote:
>> echo "you entered ".$input;
>> if($stock[$input]!=NULL)
>> {
>> $answer=$stock[$input];
>> socket_write($sock,$answer, $port);
>>
>> }
>> else{
>> echo socket_strerror(0);
>> }
>
> How about adding the following before the above lines:
> if (!isset($stock[$input]))
> print_r($stock);
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
Notice: This communication, including attachments, may contain information that is confidential. It
constitutes non-public information intended to be conveyed only to the designated recipient(s). If
the reader or recipient of this communication is not the intended recipient, an employee or agent of
the intended recipient who is responsible for delivering it to the intended recipient, or if you
believe that you have received this communication in error, please notify the sender immediately by
return e-mail and promptly delete this e-mail, including attachments without reading or saving them
in any manner. The unauthorized use, dissemination, distribution, or reproduction of this e-mail,
including attachments, is prohibited and may be unlawful. If you have received this email in error,
please notify us immediately by e-mail or telephone and delete the e-mail and the attachments (if
any).