PDO/MYSQL Problem
- From: macca <ptmcnally@xxxxxxxxxxxxxx>
- Date: Thu, 27 Mar 2008 21:39:43 -0700 (PDT)
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')");
?>
.
- Follow-Ups:
- Re: PDO/MYSQL Problem
- From: Jerry Stuckle
- Re: PDO/MYSQL Problem
- Prev by Date: how to access OpenOffice Writer (For mailmerge)
- Next by Date: Re: how to access OpenOffice Writer (For mailmerge)
- Previous by thread: how to access OpenOffice Writer (For mailmerge)
- Next by thread: Re: PDO/MYSQL Problem
- Index(es):
Relevant Pages
|