For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > January 2006 > reading contects of a file









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author reading contects of a file
William Young

2006-01-10, 4:00 am

Hello all,

I want to read the contents of a html file into a blob field in my mysql
database.

The function $par = file_get_contents($p1);

p1 is the file field. I need the html source code with all the tags to be
placed into the database by an UPDATE.

It doesnt work somehow, but i dont know what the error is.

Can someone please help me out here?

William



Jim Michaels

2006-01-16, 7:56 am

use mysql_escape_string() on your data before doing your INSERT to put it
into the database.
UPDATE will not put new data into the database. it will only UPDATE what is
already there.
mysql_query("INSERT INTO tablename(blobcolumn,column2) VALUES
('".mysql_escape_string($par)."','otherdata')", $link);
if you want to use an UPDATE,
mysql_query("UPDATE tablename SET blobcolumn='".mysql_escape_string($par)."'
WHERE id=$someid", $link);
when you want the data out, use stripslashes() on the output.

"William Young" <info2@educationalstays.com> wrote in message
news:43c105bb$0$10085$ba620dc5@text.nova.planet.nl...
> Hello all,
>
> I want to read the contents of a html file into a blob field in my mysql
> database.
>
> The function $par = file_get_contents($p1);
>
> p1 is the file field. I need the html source code with all the tags to be
> placed into the database by an UPDATE.
>
> It doesnt work somehow, but i dont know what the error is.
>
> Can someone please help me out here?
>
> William
>
>
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com