This is a discussion on "Automatically change query string variables back to normal" within the PHP Forum section. This forum, and the thread "Automatically change query string variables back to normal are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
Automatically change query string variables back to normal
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
Automatically change query string variables back to normal
I have to use the GET method to send a form entered SQL statement the page that contacts the database. To do this I am using the server variable, the problem is the string is changed to:
SELECT+*+FROM+student+WHERE+studentid+%3D+%27S001% 27 I've been told there is a function i can call will will automatically change the % stuff back to the proper characters but i don't know what it is. Can anyone help? Cheers. |
|
|
|
|||
|
Re: Automatically change query string variables back to normal
str_replace?
|
|
|||
|
Re: Automatically change query string variables back to normal
Someone thought there was a way of doing it that didn't involve doing that for every character seprately. Just a function that was designed to get around this problem. They may have been wrong.
Thanks |
|
|||
|
Re: Automatically change query string variables back to normal
You probably could make a custom function.
|
|
|||
|
Re: Automatically change query string variables back to normal
It looks like thats gonna be the case, was hoping there would be a quick way around it cos there are a lot of characters that may need changing.
Thanks anyway |
|
|||
|
Re: Automatically change query string variables back to normal
Found it in the end. parse_str takes the query string and translates all the information into usable strings.
|
|
|||
|
Re: Automatically change query string variables back to normal
Nice one
|
|
|||
|
Re: Automatically change query string variables back to normal
The information gets urlencoded when passed by using GET; the standard function is to call urldecode:
e.g. $encoded = "SELECT+*+FROM+student+WHERE+studentid+%3D+%27S001 %27"; $cleanup = urldecode($encoded); which makes $cleanup become: SELECT * FROM student WHERE studentid = 'S001' Cheers Dan |
![]() |
| Tags |
| automatically, change, query, string, variables, normal |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to automatically change date to next month? | sing2trees | PHP Forum | 1 | Apr 3rd, 2008 22:17 |
| Change a string of characters with aonether in a HTML file | r3ticul | JavaScript Forum | 4 | Jan 21st, 2008 09:28 |
| Back buton - several pages back - in HTML ? | attila001122 | Web Page Design | 1 | Dec 9th, 2007 15:51 |
| How do I change a CSS style using a query string | jim28100 | JavaScript Forum | 4 | Oct 15th, 2006 04:45 |
| is it normal? | ivyholly | Web Page Design | 5 | Jan 5th, 2006 19:56 |