icon Learn how to get the most out of Surmunity - read our forum tips here! | Welcome! Please register to access all of our features.

» Surpass Web Hosting Forums » Discussions » Coding and Programming » PHP Question. Help me out here, folks.

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread
Old March 12th, 2008, 5:07 PM   #10 (permalink)
Surpass Developer
On a golden path...
 
Mark's Avatar
 
Joined in Jan 2004
Lives in Florida
Hosted on decc.surpasshosting.com
396 posts
Gave thanks: 10
Thanked 68 times
PHP: mysql_real_escape_string - Manual
(edit: by that i mean the function mysql_real_escape_array())
I use that in all of my applications when i have large amounts of posts. However it doesn't work when passing arrays through POST, such as multiselect boxes or multiple checkboxes; it will null the array. Haven't figured out why yet
__________________
Mark
Surpass Hosting Developer
sɹnoʎ uɐɥʇ ɹǝʇʇǝq sı bıs ʎɯ
Mark is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old March 12th, 2008, 5:09 PM   #11 (permalink)
URB4N 5K1LLZ
Super #1
 
Roxy's Avatar
 
Joined in Sep 2005
Lives in Orlando, FL
Hosted on SH63
2,648 posts
Gave thanks: 81
Thanked 127 times
Quote:
Originally Posted by Mark View Post
That is true. I also don't like restoring databases

LOLZ
__________________
Roxanne
Surpass Staff

Urban Roxy -Personal Blog
SH63 - the best darn shared server!
Roxy is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old March 12th, 2008, 5:18 PM   #12 (permalink)
Cass Doesn't Sleep
Seasoned Poster
 
cass_is_awesome's Avatar
 
Joined in Mar 2008
Lives in Michigan
Hosted on SH138
78 posts
Gave thanks: 5
Thanked 6 times
Quote:
Originally Posted by Mark View Post
That is true. I also don't like restoring databases

That, my friend, is some epic stuff right there.
__________________
rockin' contrabandheart.net on SH138
cass_is_awesome is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old March 12th, 2008, 5:47 PM   #13 (permalink)
Surpass Staff
Comfy Contributor
 
Thomas's Avatar
 
Joined in Nov 2007
139 posts
Gave thanks: 9
Thanked 13 times
Quote:
Originally Posted by Mark View Post
That is true. I also don't like restoring databases

muhahahaha!!! and I was thinking of naming my kid Thomas v2.0, but never mind I found a new name!
__________________
Thomas
https://desk.surpasshosting.com/
Thomas is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old March 12th, 2008, 6:34 PM   #14 (permalink)
H
after g, before i
Super #1
 
H's Avatar
 
Joined in Jul 2004
Hosted on Gojira
7,870 posts
Gave thanks: 44
Thanked 127 times
Quote:
Originally Posted by Mark View Post
PHP: mysql_real_escape_string - Manual
(edit: by that i mean the function mysql_real_escape_array())
I use that in all of my applications when i have large amounts of posts. However it doesn't work when passing arrays through POST, such as multiselect boxes or multiple checkboxes; it will null the array. Haven't figured out why yet
You have to use a weird array_map conditional to check to see if it's an array or not. I have a code snippet somewhere... I may look it up and post it later.
H is online now  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old March 12th, 2008, 6:46 PM   #15 (permalink)
Cass Doesn't Sleep
Seasoned Poster
 
cass_is_awesome's Avatar
 
Joined in Mar 2008
Lives in Michigan
Hosted on SH138
78 posts
Gave thanks: 5
Thanked 6 times
Apparently, they don't want anyone to understand it.
__________________
rockin' contrabandheart.net on SH138
cass_is_awesome is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old March 13th, 2008, 12:11 PM   #16 (permalink)
H
after g, before i
Super #1
 
H's Avatar
 
Joined in Jul 2004
Hosted on Gojira
7,870 posts
Gave thanks: 44
Thanked 127 times
I remember it being pretty simple.. Have a custom function run through array_map on $_POST, then do a conditional to see if it's an array or not... if it is, run an array_map on that one, yada yada yada...
H is online now  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old March 13th, 2008, 1:13 PM   #17 (permalink)
Surpass Developer
On a golden path...
 
Mark's Avatar
 
Joined in Jan 2004
Lives in Florida
Hosted on decc.surpasshosting.com
396 posts
Gave thanks: 10
Thanked 68 times
I've used something like that:


PHP Code:
   function escape_array($array) {
       foreach (
$array as $key => $value) {
               if (
is_array($value)) {
                       
$array[$key] = escape_array($value);
               } else {
                       
$array[$key] = mysql_real_escape_string(trim($value));
               }
       }
       return 
$array;
    } 
However this eats them too stupid php
__________________
Mark
Surpass Hosting Developer
sɹnoʎ uɐɥʇ ɹǝʇʇǝq sı bıs ʎɯ
Mark is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may 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