| Pradeep Kumar 2007-10-31, 4:02 am |
| hi Rob,
What exactly i wanted to do is..
to take a input from a file of format :
INPUT.txt :
Details> name , id INTEGER, area VARCHAR(32)
prady,2039,india
sandy,2398,india
sam,1234,aussie
Rob,2345,Eng
extraDetails>name1 VARCHAR(12), name2 VARCHAR(12)
prady,sandy
sandy,Rob
Rob,sam
sam,prady
in the above text format u can find two tables one is Details> & the other
is extraDetails>
so i wanted to take the line Details> for creating table , & the values
below it for inserting into the table. similarly the second shud be find out
(extraDetails) & those values shud be inserted in to its table
& one more script the other way round like by getting the (retrieving) the
data from the mysql database using some queries & creating a file in the
above specified INPUT.txt format.
could u please help me in this regard
thanx
Regards
Prady
On 10/30/07, Rob Coops <rcoops@gmail.com> wrote:
>
> Hi Prady,
>
> In your example script you are feeding the execute command a set of
> strings, so you know that it will except a string.
>
> Since the creation of a table is not something that you need to prepare,
> all you will need to do is shove the create table command in a single string
> (optionally with line feeds) and hand that to the $dbh->execute() command.
>
> Whatever command your string contains is then executed on your database so
> assuming your create table command was syntactically correct SQL the table
> will be created in your database.
>
> Regards,
>
> Rob
>
> *ps, you do not need to prepare your command on the database, but since
> you are executing the same SQL command several times with just different
> variables preparing the command on the database and using placeholders will
> make the whole thing go a bit faster (assuming your database can work with
> place holders. *
>
>
> On 10/30/07, prady <prady184u@gmail.com> wrote:
>
--
wid luv
prady
|