Re: Transfer Data into MySql command

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

 



--- raul_berina_fq wrote:
> Lets say I have data like this:
> 
> USER
> 
> Id : 348374
> Name : Raul Berina
> Email : raul_berina_fq@...
> status : confirm
> 
> and PHP script should create a result like this
> 
> INSERT INTO `user` ( `id` , `Name` , `Email` , `status`) 
> `departmentid` , `status` ) 
> VALUES (
> '348374', 'Raul Berina', 'raul_berina_fq@...', 'confirm');

Looks like a matter of simple parsing. Just find the colon (:)
character using strpos and extract part of string before and after it.
Or, you can use explode or split functions.

Also, be careful with data in VALUES part. You need to escape quotes
at least. It's much easier to use parameters and avoid the trouble. If
you need to import data in database at another site, perhaps it would
be better to run parsing there as well instead of transfering the
insert statements.

-- 

Milan Babuskov
http://www.guacosoft.com



[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux