After several weeks, I am not back on this project. The problem I am experiencing is when I try to run the script through my browser I get the error message...
"Warning: PostgreSQL query failed: ERROR: Unterminated quoted string in /home/httpd/htdocs/loadandstoreindb.php on line 28."
The script that process this is as follows...
<?
$filename = "Sample.jpg";
$mysize = filesize($fielname);
$fp = fopen($filename, "r"
while(!feof($fp))
{
$data = $data . fread($fp,1);
}
fclose($fp);
$database = pg_connect(myconnectstring);
$MyInsert = "INSERT INTO Test2 VALUES (4545, 2, '" . $data . "')";
pg_exec($database, $MyInsert); //ERROR HERE!
?>
I tried appending the string with a "/n", but that didn't help. Could someone clue me in here? Perhaps, since this is a string containing a JPG image, we could convert this to binary somehow? If so, which function does this?
BTW, the field that I am trying to write the image to is of type "bytea".
Any ideas?
Thanks,
Gary
gwinn7
"Warning: PostgreSQL query failed: ERROR: Unterminated quoted string in /home/httpd/htdocs/loadandstoreindb.php on line 28."
The script that process this is as follows...
<?
$filename = "Sample.jpg";
$mysize = filesize($fielname);
$fp = fopen($filename, "r"
while(!feof($fp))
{
$data = $data . fread($fp,1);
}
fclose($fp);
$database = pg_connect(myconnectstring);
$MyInsert = "INSERT INTO Test2 VALUES (4545, 2, '" . $data . "')";
pg_exec($database, $MyInsert); //ERROR HERE!
?>
I tried appending the string with a "/n", but that didn't help. Could someone clue me in here? Perhaps, since this is a string containing a JPG image, we could convert this to binary somehow? If so, which function does this?
BTW, the field that I am trying to write the image to is of type "bytea".
Any ideas?
Thanks,
Gary
gwinn7