Re: [PHP] using mysql_escape_string with implode() !!

2007-06-01 Thread Richard Lynch
Seems to me you'd be better off then writing code to handle all of these, with is_array() doing the walk, and erroring out for Object and Resource Actually, an object should get type-casted to a string, and there's even that nifty thing in PHP 5 where you can control what string it gets changed to

Re: [PHP] using mysql_escape_string with implode() !!

2007-05-31 Thread Jim Lucas
Richard Lynch wrote: On Wed, May 30, 2007 9:55 pm, Jim Lucas wrote: Greg Donald wrote: On 5/30/07, Richard Lynch <[EMAIL PROTECTED]> wrote: You want to use mysql_escape_string, and NOT addslashes and NOT Magic Quotes. function slashes( $var ) { if( is_array( $var ) ) { return array_map(

Re: [PHP] using mysql_escape_string with implode() !!

2007-05-31 Thread Richard Lynch
On Wed, May 30, 2007 9:55 pm, Jim Lucas wrote: > Greg Donald wrote: >> On 5/30/07, Richard Lynch <[EMAIL PROTECTED]> wrote: >>> You want to use mysql_escape_string, and NOT addslashes and NOT >>> Magic >>> Quotes. >> >> function slashes( $var ) >> { >> if( is_array( $var ) ) >> { >>return arr

Re: [PHP] using mysql_escape_string with implode() !!

2007-05-30 Thread Greg Donald
On 5/30/07, Jim Lucas <[EMAIL PROTECTED]> wrote: Say I wanted to use this on something other than $_GET, $_POST, & $_COOKIE? Then I suppose you'll have to compensate with updates to support your particular usage. -- Greg Donald http://destiney.com/ -- PHP General Mailing List (http://www.php

Re: [PHP] using mysql_escape_string with implode() !!

2007-05-30 Thread Jim Lucas
Greg Donald wrote: On 5/30/07, Richard Lynch <[EMAIL PROTECTED]> wrote: You want to use mysql_escape_string, and NOT addslashes and NOT Magic Quotes. function slashes( $var ) { if( is_array( $var ) ) { return array_map( 'slashes', $var ); } else { return mysql_real_escape_string( $v

Re: [PHP] using mysql_escape_string with implode() !!

2007-05-30 Thread Greg Donald
On 5/30/07, Richard Lynch <[EMAIL PROTECTED]> wrote: You want to use mysql_escape_string, and NOT addslashes and NOT Magic Quotes. function slashes( $var ) { if( is_array( $var ) ) { return array_map( 'slashes', $var ); } else { return mysql_real_escape_string( $var ); } } set_magi

Re: [PHP] using mysql_escape_string with implode() !!

2007-05-30 Thread Richard Lynch
You want to use mysql_escape_string, and NOT addslashes and NOT Magic Quotes. On Fri, May 25, 2007 12:34 pm, Rahul Sitaram Johari wrote: > > Ok, I'm not able to use array_map() at all to my benefit, or at least > I > can't figure out how to. > > I'm trying to generate the string with escape slashe

Re: [PHP] using mysql_escape_string with implode() !!

2007-05-30 Thread Richard Lynch
On Fri, May 25, 2007 10:32 am, Rahul Sitaram Johari wrote: > > Ave, > > I¹m inserting values out of an array into mySQL. There¹s other values > besides the array values that are being inserted as well. This is my > simple > INSERT code: array_map('mysql_real_escape_string', $var); This assumes

Re: [PHP] using mysql_escape_string with implode() - SOLVED!

2007-05-25 Thread Rahul Sitaram Johari
Ave, Alright, here's I solved it. Used the array_walk function. This is my code: function test_alter(&$item1) { $item1 = mysql_escape_string($item1); } array_walk($var, 'test_alter'); $var = implode("','", $var); $sql = "INSERT INTO nimo_account(Date,Time,Phone,Account,AccountType,RateC

Re: [PHP] using mysql_escape_string with implode() !!

2007-05-25 Thread Rahul Sitaram Johari
Ok, I'm not able to use array_map() at all to my benefit, or at least I can't figure out how to. I'm trying to generate the string with escape slashes before I put it in the INSERT statement, but it's not working primarily because values have to be enclosed in Single Quotes while inserting into m

Re: [PHP] using mysql_escape_string with implode() !!

2007-05-25 Thread Zoltán Németh
2007. 05. 25, péntek keltezéssel 11.32-kor Rahul Sitaram Johari ezt írta: > Ave, > > I¹m inserting values out of an array into mySQL. There¹s other values > besides the array values that are being inserted as well. This is my simple > INSERT code: > > $sql = "INSERT INTO db > (Date,Time,Phone,Acc

[PHP] using mysql_escape_string with implode() !!

2007-05-25 Thread Rahul Sitaram Johari
Ave, I¹m inserting values out of an array into mySQL. There¹s other values besides the array values that are being inserted as well. This is my simple INSERT code: $sql = "INSERT INTO db (Date,Time,Phone,Account,AccountType,RateClass,VoltLevel,IsoZone,TaxDist,Loa dProfile,ServiceName,ServiceAddr