简体   繁体   中英

results not binding with stored procedure call MySQL php

I am new to stored procedures, and i am having an issue with the results returned by the stored procedure not having any values when i call the stored procedure via PHP. When i manually make the call directly on the MySQL server it works fine and returns 5 values. When i call the procedure through php no values are stored in the binding variables.

Stored Procedure:

DELIMITER $$

    CREATE PROCEDURE `TPE_GET_current_repair` (IN current_repair_vid VARCHAR(45))
    BEGIN
    SELECT current_repair_vid v1;

    SELECT 
        sys_vendor.vendor, 
        receive_date, 
        tape_repair_problem_code.tape_repair_problem_reason, 
        sys_tape_type.tape_type, 
        sys_capture_location.capture_location
    FROM tape_repair
        INNER JOIN `sys_vendor` on tape_repair.vendor_id = sys_vendor.id
        INNER JOIN `tape_repair_problem_code` on tape_repair.problem_code = tape_repair_problem_code.id
        INNER JOIN `sys_tape_type` on tape_repair.tape_type_id = sys_tape_type.id
        INNER JOIN `sys_capture_location` on tape_repair.capture_location_id = sys_capture_location.id
    WHERE vid = current_repair_vid;
    END

PHP:

$repairData = "CALL TPE_GET_current_repair('$vid')";
    if ($stmt = $mysqli->prepare($repairData)) {
        $stmt->execute();
        $stmt->bind_result($rpr_vendor, $rpr_rcv_date, $rpr_problem, $rpr_tape_type, $rpr_capt_loctn);
        $stmt->fetch();
    }

我已解决此问题,我已经忘记了第一条select语句,这导致该语句失败。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM