Automatically change query string variables back to normal

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.



Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Mar 30th, 2006, 21:39
New Member
Join Date: Mar 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
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.
Reply With Quote

  #2 (permalink)  
Old Mar 30th, 2006, 21:48
Most Reputable Member
Join Date: Aug 2005
Location: North Wales, United Kingdom
Age: 21
Posts: 1,093
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to sypher
Re: Automatically change query string variables back to normal

str_replace?
Reply With Quote
  #3 (permalink)  
Old Mar 30th, 2006, 21:55
New Member
Join Date: Mar 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
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
Reply With Quote
  #4 (permalink)  
Old Mar 30th, 2006, 21:59
Most Reputable Member
Join Date: Aug 2005
Location: North Wales, United Kingdom
Age: 21
Posts: 1,093
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to sypher
Re: Automatically change query string variables back to normal

You probably could make a custom function.
Reply With Quote
  #5 (permalink)  
Old Mar 30th, 2006, 22:01
New Member
Join Date: Mar 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
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
Reply With Quote
  #6 (permalink)  
Old Mar 30th, 2006, 22:26
New Member
Join Date: Mar 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
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.
Reply With Quote
  #7 (permalink)  
Old Mar 30th, 2006, 22:49
Most Reputable Member
Join Date: Aug 2005
Location: North Wales, United Kingdom
Age: 21
Posts: 1,093
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to sypher
Re: Automatically change query string variables back to normal

Nice one
Reply With Quote
  #8 (permalink)  
Old Apr 13th, 2006, 18:59
Junior Member
Join Date: Jan 2006
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
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
Reply With Quote
Reply

Tags
automatically, change, query, string, variables, normal

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

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


All times are GMT. The time now is 05:41.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43