Ciao tutti,
ho un problema con una query, sono sicuro che e' una questione di compatibilita' di dati che vengono dal form e dal PHP e il Databse, sostanzialmente ho fatto uno script per memorizzare file nel database.
ecco lo script:
Codice PHP:
Codice PHP:
$connection = new database_connection(); // Gather all required data
$newDesign->file_name = $_FILES['userfile']['name'];
$newDesign->file_type = $_FILES['userfile']['type'];
$newDesign->file = file_get_contents($_FILES ['userfile']['tmp_name']);
// size file is not important now //$size = intval($_FILES['uploaded_file']['size']); //echo "<br/>" . $newDesign->file;
// Create the SQL query
$query = "
INSERT INTO design (
id_design, id_designer, length, width, description, status, date, file
)
VALUES (
'$newDesign->code', '$newDesign->designer', '$newDesign->length', '$newDesign->width', '$newDesign->description', '$newDesign->status', '$newDesign->date', '$newDesign->file' )";
// Execute the query
$result = $connection->execute ($query);
Il campo FILE della tablella DESIGN e' di tipo BLOB, l'attributo file del oggeto $newDesign e' un file che arriva dal database, se inserisco i campi a uno a uno l'unico che da problemi e' quello FILE.
ecco la tabella come e' stata dichiarata
Codice PHP:
Codice PHP:
file blob No None