Forum Moderators: coopster

Message Too Old, No Replies

curious behaviour with array map 'callback' option

array_map problems

         

Matthew1980

9:48 pm on May 20, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi all,

Maybe its me, but I thought I would ask if anyone has had trouble using mysql_real_escape_string as the callback option in array_map.

I have just found that when using it, the function tries to connect to my database - surely that's not right? And then erases the values in the elements of the given array. Comment out the line and hey-presto, data gets through!

Thoughts?

Cheers,

MRb

Alcoholico

10:16 pm on May 20, 2010 (gmt 0)

10+ Year Member



Have you taken into account what they say about this function:
If the link identifier is not specified, the last link opened by mysql_connect() is assumed. If no such link is found, it will try to create one as if mysql_connect() was called with no arguments.
?
Did you pass the connection link id to the array_map callback function (mysql_real_escape_string)?

Matthew1980

10:30 pm on May 20, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi there Alcoholico,

There is no connection function being called - hence the error, force of habit I guess, usually there is already an established connection going when I use this function, so I seldom reference one in the function when I call it normally.

I was reading the function description after I posted. Gah!

At least I know for next time :)

Case of RTFM (Read The Flippin' Manual) methinks.

Cheers,
MRb