Variable contains numbers spaces and text.
- From: "screechyboy@xxxxxxxxxxxxxx" <screechyboy@xxxxxxxxxxxxxx>
- Date: Fri, 4 Apr 2008 03:15:12 -0700 (PDT)
I have a variable called $selectteam which is posted from a html form
and contains the value 'Team Alpha 1st Line'
My code for getting this variable is as follows:
$selectteam = $_POST['selectteam']
When i come to query my database with the following code:
$link = "SELECT * FROM tbl_call_data WHERE and Team1=$selectteam"
I get this error:
Incorrect syntax near 'Alpha'
This looks to me like it doesnt like the space so i found urlencode
which nearly did it:
$selectteam = urlencode($_POST['selectteam'])
I now get:
Incorrect syntax near 'st'
This looks to me like it doesnt like the 1, any help getting round
this would be greatfully received.
I cannot remove the spaces as the database it rights this info to must
remain in the same format for other dependancies (the database wasnt
created by me).
Many Thanks
.
- Follow-Ups:
- Re: Variable contains numbers spaces and text.
- From: Michael Fesser
- Re: Variable contains numbers spaces and text.
- Prev by Date: Re: File Removal after Database Comparison
- Next by Date: Re: Variable contains numbers spaces and text.
- Previous by thread: Trouble auto-submitting a form with CURL
- Next by thread: Re: Variable contains numbers spaces and text.
- Index(es):
Relevant Pages
|