0

I'm using adodb5 to call this stored procedure but MySQL doesn't understand $sealID is a string.

$db = NewADOConnection('mysql://'.DB_USER.':'.DB_PASS.'@'.DB_SERVER.'/'.DB_NAME);
$sql = "CALL GetSeal($userID, $sealID, @result)";
$r = $db->Execute($sql);

When I run this php from shell.

TestGetSealProc.php 3155011 ZZZZNLJSAYGZECWY

MySQL reports:

Unknown column 'ZZZZNLJSAYGZECWY' in 'field list'

ZZZZNLJSAYGZECWY must be understood as a string but a column. How to fix it?

Update: first part of my stored proc.

    CREATE DEFINER=`root`@`localhost` PROCEDURE `GetSeal`(IN userID INT, IN sealID char(16), OUT result INT)
    BEGIN

        DECLARE imageCnt INT;
        DECLARE pointCnt INT;
        DECLARE puriCode varchar(256);
        DECLARE newImgID INT;
....

        DECLARE c_data CURSOR FOR
            SELECT TELEPHONE_NUMBER, IMG_FILENAME, SELECTION_FLG, PHOTOGRAPH_DATE, SEND_DATE
            FROM re_photograph_imgs
            WHERE SEAL_NUMBER = sealID
            AND IMG_FILENAME IS NOT NULL
            AND IMG_FILENAME != "";

......................

0

1 Answer 1

1

Don't forget quotes. Without them, a bare string will be interpreted as a field name:

$sql = "CALL GetSeal($userID, '$sealID', @result)";
                              ^       ^
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.