You are here: Re: Import .sql file via PHP « PHP Programming Language « IT news, forums, messages
Re: Import .sql file via PHP

Posted by Ivan Omelchenko 608308824 on 10/16/66 11:17

Tim Van Wassenhove пишет:
> On 2005-05-30, Jamie Meyers <gtg061q@mail.gatech.edu> wrote:
>
>>Nevermind, I decided to parse the .sql file and create the query there. I
>>do not think there is any way to import the .sql file via php. Thanks
>>anyways. And if anyone would like this script after I fix it up a little
>>more, let me know.
>
>
> Assuming each instruction is on a line.. (untested)
>
> $db = mysql_connect(....);
> mysql_select_db(....);
>
> $fp = fopen('somefile.sql', 'r');
> while($fp != feof())
> {
> $line = fread($fp, 2048);
> $line = mysql_real_escape_string($db, $line);
> mysql_query($line);
> }
> fclose($fp);
>
>
I guess it will NOT working, because of line can be much more than 2048
bytes, or it can be BLOB or another..
Or, can be comment multi line. your script will failed.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация