Re: [PHP] INSERT Array Values into mySQL Table

2007-05-02 Thread Richard Lynch
On Wed, May 2, 2007 10:42 am, Rahul S. Johari wrote: > Here¹s the thing, I¹ve got an Array which has it¹s own set of Keys => > Values. I¹m using foreach() to read the Keys => Values like this: > //note added arguments! > function pr1($var, $var2, $var3) { > foreach ($var as $k => $

RE: [PHP] INSERT Array Values into mySQL Table

2007-05-02 Thread Richard Lynch
On Wed, May 2, 2007 11:03 am, Jim Moseby wrote: >> >> $sql = "INSERT INTO table (f1, f2, f3, ". implode(",", >> array_keys($pr1)) .") >>VALUES ('abc', '123', '456', ". implode(",", >> array_values($pr1)) >> .")"; >> >> HTH, >> >> Brad > > > Might not work if the array values need to be en

Re: [PHP] INSERT Array Values into mySQL Table - SOLVED!

2007-05-02 Thread Rahul Sitaram Johari
WORKS Like A Charm!! :) Thanks. On 5/2/07 12:14 PM, "Brad Fuller" <[EMAIL PROTECTED]> wrote: > Jim Moseby wrote: >>> $sql = "INSERT INTO table (f1, f2, f3, ". implode(",", >>> array_keys($pr1)) .") VALUES ('abc', '123', '456', ". implode(",", >>> array_values($pr1)) >>> .")"; >>> >>> HTH, >>

RE: [PHP] INSERT Array Values into mySQL Table

2007-05-02 Thread Brad Fuller
Jim Moseby wrote: >> $sql = "INSERT INTO table (f1, f2, f3, ". implode(",", >>array_keys($pr1)) .") VALUES ('abc', '123', '456', ". implode(",", >> array_values($pr1)) >> .")"; >> >> HTH, >> >> Brad > > > Might not work if the array values need to be enclosed in > quotes. I would build

Re: [PHP] INSERT Array Values into mySQL Table

2007-05-02 Thread Rahul Sitaram Johari
Ave, I was just about to post when I saw your message. I think what you're saying is exactly what is happening. The values have Spaces and stuff so Quotes are Required - cannot have values not enclosed in Quotes. Other then that it was actually working. Is there a way to enclose in Quotes using

RE: [PHP] INSERT Array Values into mySQL Table

2007-05-02 Thread Jim Moseby
> > $sql = "INSERT INTO table (f1, f2, f3, ". implode(",", > array_keys($pr1)) .") > VALUES ('abc', '123', '456', ". implode(",", > array_values($pr1)) > .")"; > > HTH, > > Brad Might not work if the array values need to be enclosed in quotes. I would build the query string in a for

Re: [PHP] INSERT Array Values into mySQL Table

2007-05-02 Thread David Giragosian
On 5/2/07, Rahul S. Johari <[EMAIL PROTECTED]> wrote: Ave, Here¹s the thing, I¹ve got an Array which has it¹s own set of Keys => Values. I¹m using foreach() to read the Keys => Values like this: function pr1($var) { foreach ($var as $k => $v) { echo ³$k => $v²;

RE: [PHP] INSERT Array Values into mySQL Table

2007-05-02 Thread Brad Fuller
Rahul S. Johari wrote: > Ave, > > Here¹s the thing, I¹ve got an Array which has it¹s own set of > Keys => Values. I¹m using foreach() to read the Keys => Values like > this: > > function pr1($var) { > foreach ($var as $k => $v) { > echo ³$k => $v²; > } >