Jump to content


Photo

Insert Image Into Database


  • Please log in to reply
No replies to this topic

#1 melban

melban
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 31 October 2005 - 09:54 PM

I've got a PeopleSoft DB that I'm pulling images from with a PHP script using OCI. I am able to pull images and save them to .jpg files and everything works fine. When I try and insert a new image into the DB I am having issues. Here is what I'm doing.

Reading *.jpg to a file call $img[!--PHP-Head--][div class=\'phptop\']PHP[/div][div class=\'phpmain\'][!--PHP-EHead--]$img = fread(fopen(\'pic.jpg\', \'r\'), filesize(\'pic.jpg\'));[/span][!--PHP-Foot--][/div][!--PHP-EFoot--]

Putting query together [!--PHP-Head--][div class=\'phptop\']PHP[/div][div class=\'phpmain\'][!--PHP-EHead--]$sql = \"INSERT INTO PS_PROD_IMAGES     (SETID,    PRODUCT_ID,    IMAGE_SIZE,    DESCR, PSIMAGEVER, ROW_ADDED_DTTM, ROW_ADDED_OPRID,    ROW_LASTMANT_DTTM, ROW_LASTMANT_OPRID,     SYNCID, SYNCDTTM, PROD_IMG_JPG)    VALUES    (\'SHARE\', \'15001\', \'L\', \' \', \'\".$mxi++.\"\', SYSDATE, \'SMELBAN\',      SYSDATE, \'SMELBAN\', \'0\', SYSDATE, \'\".$img.\"\')\";[/span][!--PHP-Foot--][/div][!--PHP-EFoot--]

Running query[!--PHP-Head--][div class=\'phptop\']PHP[/div][div class=\'phpmain\'][!--PHP-EHead--]$c=OCILogon($db[\'user\'], $db[\'pass\'], $db[\'db\']);
$s = OCIParse($c, $sql);
OCIExecute($s);[/span][!--PHP-Foot--][/div][!--PHP-EFoot--]

And then here is what I get
Successfully connected to Oracle.

Warning: ociparse() [function.ociparse]: OCIParse: ORA-00972: identifier is too long in e:\wamp\www\norwood.com_tools\update 06 images\index.php on line 50

Warning: ociexecute(): supplied argument is not a valid OCI8-Statement resource in e:\wamp\www\norwood.com_tools\update 06 images\index.php on line 51

My image file is 3.89kb large. I've also tried with a smaller 2.31kb file.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users