Re: Insert File in a Database
| From: | (Stig Sæther Bakken) | Date: | Thu, 24 May 2001 07:41:24 +0000 |
| Subject: | Re: Insert File in a Database | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-9591@lists.php.net to get a copy of this message | ||
["Anderson Sone" <sone@mail.com>]
> How can i insert a file in a Database?
> I´m using PHP + MSSQL 2k
>
> I´m trying to insert a .doc file in a db. I read the file and put it in a
> db.
> I´m having a lot of problem... like:
> _____________
> Warning: MS SQL message: Unclosed quotation mark before the character string
> 'ÐÏà¡Ýá'. (severity 15) in C:\PHP/upload/upload4.php3 on line 28
> _____________
If you are using PHP's ODBC functions, all you need to do is:
$stmt = odbc_prepare("INSERT INTO table VALUES(?)");
$res = odbc_execute($stmt, array("'/path/to/file'"));
Notice the single quotes around the file name.
If you're using the mssql functions, I don't know.
- Stig
--
Stig Sæther Bakken <ssb@fast.no>
Fast Search & Transfer ASA, Trondheim, Norway