You are here: Re: Insert text file in a text field « PHP Programming Language « IT news, forums, messages
Re: Insert text file in a text field

Posted by electric_r on 10/19/07 11:59

On 18 Ott, 19:33, "Rik Wasmus" <luiheidsgoe...@hotmail.com> wrote:
> On Thu, 18 Oct 2007 19:29:54 +0200, Rik Wasmus
>
>
>
> <luiheidsgoe...@hotmail.com> wrote:
> > On Thu, 18 Oct 2007 18:36:59 +0200, <electri...@yahoo.it> wrote:
>
> >> Hallo,
>
> >> I have 2 questions:
>
> >> with php and mysql :
>
> >> 1) How can I insert a text file into a TEXT field of a table ?
>
> >> 2) How can I insert a microsoft word file into a BLOB field of a
> >> table ?
>
> >> Please, could you help me with a simple example ?
>
> > mysql_query("INSERT INTO tablename (fieldname) VALUES
> > ('".mysql_real_escape_string(file_get_contents('/path/to/file'))."')");
>
> Hmmm,
> or: mysql_query("INSERT INTO tablename (fieldname) VALUES
> (LOAD_FILE('/path/to/file'))");
>
> For this you'd have to make sure:
> - the database is on the same host as the file
> - you have the FILE privilege
> - the file is readable
> - the filesize is less than max_allowed_packet bytes
>
> --
> Rik Wasmus


Thank you very much .

Another question:
after I put a text file in a text field,
then, how can I read this field content and put it into
a php variable ?

Many thanks .

Fabrizio

 

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

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