RE: query help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hey,

You can also try PEAR module MDB2 to insert an array into a table. The
function is: "executeMultiple". This works for other SQL queries too.

Check this link please:
http://pear.php.net/manual/en/package.database.mdb2.intro-execute.php

Cheers,


-----Original Message-----
From: Artur Ejsmont [mailto:ejsmont.artur@xxxxxxxxx] 
Sent: 17 noiembrie 2010 16:07
To: Vinay Kannan
Cc: PHP DB; php mysql
Subject: Re:  query help

well .... i guess you could do that. but it gets complicated after a while
and there will be a lot of work and probably after a while you will get into
some problems. You have to handle escaping, special types etc. Then what
about performance? how to query the data ...
using similar approach or is it just for inserts? there is a bit of work to
make it really usable i guess.

I am not saying its wrong though, I have seen this approach twice ...
in general its possible.

Maybe better choice would be to try to use some orm ? there are plenty of
frameworks out there .... the only problem is the learning curve may be
steep.

What others think?

art

On 17 November 2010 13:51, Vinay Kannan <vinykan@xxxxxxxxx> wrote:
> Hello PHP Gurus,
>
> I need your help on an insert query.
>
> I wanted to know if there is way to insert an array of values into a 
> DB. An eg would explain this better :
>
> If I have 2 tables in a DB, 1) users has 3 columns 2) hobbies = 5 
> columns
>
> I was thinking of having a single function which will perform the 
> insert on any  insert which happens on the entire website.
>
> Eg : This function can be called with 2 parameters, the first 
> parameter the table name, and the second parameter is an array of 
> values which will be inserted into the table.
> eg : Users has these columns [1]ID [2] Name [3]Location so the 
> function call would be something like *
> insert_into_tbale(users,array[user_values])*
> **
> Does this make sense ? Is this a good method to follow ?
>
> Thanks in advance !
>
> Vinay Kannan.
>



--
Visit me at:
http://artur.ejsmont.org/blog/

--
PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux