Inserting a blob
Posted: Thu Dec 31, 2009 8:59 am
Hi,
I've been trying to upload a file to a mysql table all day.
here is the table:
and here is the insert:
The table gets created just fine, but the insert query doesn't work. It echos "success," but the table remains empty.
I've tried writing the insert query a bunch of different ways, but nothing changes.
please help. thanks
I've been trying to upload a file to a mysql table all day.
here is the table:
Code: Select all
$cv = "CREATE TABLE `$proName` (
`id` Int Unsigned Not Null Auto_Increment,
`name` VarChar(255) Not Null Default 'Untitled.txt',
`mime` VarChar(50) Not Null Default 'text/plain',
`size` BigInt Unsigned Not Null Default 0,
`data` MediumBlob Not Null,
`createdDate` DateTime Not Null,
`createdBy` VarChar(50) Not Null,
PRIMARY KEY (`id`)
)";
Code: Select all
$ti = "INSERT INTO '$proName' (name, mime, size, data, createdDate, createdBy)
VALUES ('$name', '$mime', '$size', '$data', '$date', '$accName')";
$result = "mysql_query($ti, $con)";
if ($result)
{ echo "Success. "; }
else
{ echo "Fail. "; }
I've tried writing the insert query a bunch of different ways, but nothing changes.
please help. thanks