Re: PDO/MYSQL Problem
- From: Jerry Stuckle <jstucklex@xxxxxxxxxxxxx>
- Date: Fri, 28 Mar 2008 16:50:30 -0500
macca wrote:
ok,
I changed the statement to this
$pdo->exec("INSERT INTO file(filename) VALUES('$file')") or
die(print_r($pdo->errorInfo()));
And go this error
Array ( [0] => 42000 [1] => 1064 [2] => You have an error in your SQL
syntax; check the manual that corresponds to your MySQL server version
for the right syntax to use near 'â/îÚ{%9²°†3äìÛZûòæÝc¤6öîÏË»7Ëe¬"µ
\ß-Tˆ¿…JÒ<ÈTA‡‰Zîî V›»Y„a”ªeyG«$WËÃÝGoé' at line 1 ) 1
So then i added addslashes() to the file_get_contents() like so:
$file = addslashes(file_get_contents('document.pdf'));
and it worked fine.
Thanks Jerry
You shouldn't use addslashes(). Rather, you should be using mysql_real_escape_string(), or, better yet, bind variables in PDO.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@xxxxxxxxxxxxx
==================
.
- Follow-Ups:
- Re: PDO/MYSQL Problem
- From: macca
- Re: PDO/MYSQL Problem
- References:
- PDO/MYSQL Problem
- From: macca
- Re: PDO/MYSQL Problem
- From: Jerry Stuckle
- Re: PDO/MYSQL Problem
- From: macca
- PDO/MYSQL Problem
- Prev by Date: Re: Can a website block the use of file_get_contents ?
- Next by Date: Apache php module docs?
- Previous by thread: Re: PDO/MYSQL Problem
- Next by thread: Re: PDO/MYSQL Problem
- Index(es):
Relevant Pages
|