PDO/MYSQL Problem



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')");

?>
.



Relevant Pages

  • RE: [PHP] mysql load_file retreival
    ... Seems to me that it would waste a lot of db space as base64 encoding ... Subject: [PHP] mysql load_file retreival ... with writing the raw data from the mysql client to disk. ... Try looking at the data that's supposed to be outputing the pdf. ...
    (php.general)
  • RE: [PHP] mysql load_file retreival
    ... Try looking at the data that's supposed to be outputing the pdf. ... may be failing somewhere and you might see an error message. ... Subject: [PHP] mysql load_file retreival ... based on reading from mysql that it did escape certain ...
    (php.general)
  • RE: [PHP] mysql load_file retreival
    ... with writing the raw data from the mysql client to disk. ... script though. ... Try looking at the data that's supposed to be outputing the pdf. ... PHP General Mailing List ...
    (php.general)
  • Re: Umfrage zur Fahrradnutzung - jetzt auch online
    ... als PDF macht, wo doch HTML, PHP, mySQL und Co. existieren. ...
    (de.rec.fahrrad)
  • mysql load_file retreival
    ... I have set up a script to recieve a pdf file and store it in a mysql db ... Afterwards I can see the file has been uploaded into the blob field ... I get the prompt to open with pdf but pdf fails. ...
    (php.general)