melban Posted October 31, 2005 Share Posted October 31, 2005 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. Quote Link to comment https://forums.phpfreaks.com/topic/2773-insert-image-into-database/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.