Submit Your Article Webforumz RegistrationAnnouncements Contact Webforumz StaffContact
Home Resources Blogs Meet the Team Contact Register
 

Go Back   WebForumz.com > The Code > PHP

Reply
 
LinkBack Thread Tools
Old March 30th, 2006, 04:39 PM   #1
New Member
 

Join Date: Mar 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 kaligula1234 is on a distinguished road
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.
kaligula1234 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old March 30th, 2006, 04:48 PM   #2
Most Reputable Member
 

Join Date: Aug 2005
Location: North Wales, United Kingdom
Age: 23
Posts: 1,063
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 sypher has a spectacular aura about sypher has a spectacular aura about
Re: Automatically change query string variables back to normal

str_replace?
__________________
North Wales Web Design - sypher design
sypher is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old March 30th, 2006, 04:55 PM   #3
New Member
 

Join Date: Mar 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 kaligula1234 is on a distinguished road
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
kaligula1234 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old March 30th, 2006, 04:59 PM   #4
Most Reputable Member
 

Join Date: Aug 2005
Location: North Wales, United Kingdom
Age: 23
Posts: 1,063
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 sypher has a spectacular aura about sypher has a spectacular aura about
Re: Automatically change query string variables back to normal

You probably could make a custom function.
__________________
North Wales Web Design - sypher design
sypher is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old March 30th, 2006, 05:01 PM   #5
New Member
 

Join Date: Mar 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 kaligula1234 is on a distinguished road
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
kaligula1234 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old March 30th, 2006, 05:26 PM   #6
New Member
 

Join Date: Mar 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 kaligula1234 is on a distinguished road
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.
kaligula1234 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old March 30th, 2006, 05:49 PM   #7
Most Reputable Member
 

Join Date: Aug 2005
Location: North Wales, United Kingdom
Age: 23
Posts: 1,063
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 sypher has a spectacular aura about sypher has a spectacular aura about
Re: Automatically change query string variables back to normal

Nice one
__________________
North Wales Web Design - sypher design
sypher is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old April 13th, 2006, 02:59 PM   #8
New Member
 

Join Date: Jan 2006
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 dannyboy26 is on a distinguished road
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
dannyboy26 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Bookmarks

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


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 1 April 3rd, 2008 06:17 PM
Change a string of characters with aonether in a HTML file r3ticul JavaScript 4 January 21st, 2008 05:28 AM
Back buton - several pages back - in HTML ? attila001122 HTML, XHTML and CSS 1 December 9th, 2007 11:51 AM
How do I change a CSS style using a query string jim28100 JavaScript 4 October 15th, 2006 12:45 AM
is it normal? ivyholly HTML, XHTML and CSS 5 January 5th, 2006 03:56 PM


Search Engine Optimization by vBSEO 3.2.0 RC8