|
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]
|