strip spaces

     case 'searchbyorderid':
        $this->sql = "FROM orders WHERE orderid like '%$this->text%'";
        break;


want to strip ' '
from
$this->text


so if a person searches for orderid
' 700 '
they will get
'700'
LVL 1
rgb192Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

subscriptCommented:
0
kumaranmcaCommented:
Hi Rgb,

You are search the value of  "Order id". I think order is number datatype.. no need add ' ' of your query...

Refer the below query...its helpful for you

  $this->sql = "Select * FROM orders WHERE orderid like %$this->text%";
0
kumaranmcaCommented:
trim function is good solution, str_replace function to resolve your problem...refer the below code

$inputdata=str_replace(' ','',$this->text);
remove your space on input string

  $this->sql = "Select * FROM orders WHERE orderid like %$inputdata";
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rgb192Author Commented:
thanks
0
subscriptCommented:
The accepted solution works okay unless you search on multiple words (a phrase).

For multiple words -- you need spaces between them, which is why I still believe trim function is the better solution.

        $inputdata = trim($this->text);

        $this->sql = "FROM orders WHERE orderid like '%$inputdata%'";
        break;

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.