Ranger Giya
2009-10-22 08:23:59 UTC
I have this table in my database...this part work...
CREATE TABLE IF NOT EXISTS spacelocation (
spacelocationid BIGINT NOT NULL AUTO_INCREMENT, PRIMARY KEY(spacelocationid),
image BLOB,
name VARCHAR(255) NOT NULL UNIQUE,
);
the spaceloctionid and name already exist...i just need to add the image...
and this is the php...
// Read the image bytes into the $data variable
$fh = fopen("planet1.JPG", "rb");
$data = addslashes(fread($fh,filesize("planet1.JPG")));
fclose($fh);
// Create the query
$SQL = "INSERT INTO spacelocation(image) VALUES(\"".$data."\) WHERE spacelocationid = 2";
// Execute the query
$RESULT = mysql_query($SQL) or die("Couldn't insert image");
but I keep getting the error and it just says Couldn't insert image.
what am I doing wrong please help...