Re: PDO/MYSQL Problem
- From: Jerry Stuckle <jstucklex@xxxxxxxxxxxxx>
- Date: Fri, 28 Mar 2008 06:58:48 -0500
macca wrote:
Hi, I'm trying to store a pdf in mysql, any ideas why this isnt
working? If i exchange $file for 'test', that works. Bit confused. Any
ideas?
<?php
try {
$pdo = new
PDO('mysql:host=localhost;dbname=pdf','root','password');
} catch(PDOException $e) {
echo "An error occured when connecting: ".$e->getMessage();
}
// insert a pdf into the database
$file = file_get_contents('document.pdf');
$pdo->exec("INSERT INTO file(filename) VALUES('$file')");
?>
It should be:
$pdo->exec("INSERT INTO table(column) VALUES('$file')");
But I think that's what you mean (at least I hope so).
How big is your PDF? How big is your column? What is the result of the $pdo->exec() call? If it's false, what's the error?
--
==================
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
- PDO/MYSQL Problem
- Prev by Date: Problems using bitwise &
- Next by Date: Re: Php 5 and DST - touch not working
- Previous by thread: PDO/MYSQL Problem
- Next by thread: Re: PDO/MYSQL Problem
- Index(es):
Relevant Pages
|