duangaixing1509 2019-03-23 19:09
浏览 89

循环中的多个mysqli prepare语句不起作用

this is my code where i have problem, here i am not getting any result for stmt2 fetch data,

$result = $user_hash_conn->query($q1);
    if($result->num_rows > 0){
        $stmt = $store_conn->prepare('SELECT `location`,`institute`, `category`, `sub_category`, `date`,`title`, `message` FROM `pre_demand_by_key` WHERE `key`=?');
        $stmt->bind_param("s",$key);

        # for no of match found 
        $stmt2 =  $store_conn->stmt_init();
        $stmt2 = $store_conn->prepare('SELECT `key` FROM `store_list` WHERE `location`=? AND `institute` LIKE ? AND `category`=? AND `sub_category` LIKE ?');



        while($row = $result->fetch_assoc()){

            $key = $row['varchar_128'];

            $stmt->execute();

            $stmt->bind_result($location,$institute,$category,$sub_category,$date,$title,$message);

            while($stmt->fetch()){

                #no of match found 
                $location2 = $location;
                $institute2 = $institute."%";
                $category2 = $category;
                $sub_category2 = $sub_category."%";

                $stmt2->bind_param("ssss",$location2,$institute2,$category2,$sub_category2);

                $stmt2->execute();
                $stmt2->bind_result($item_key2);
                echo $stmt2->error;
                $item_keys = [];
                while($stmt2->fetch()){
                    echo $item_key2;
                }



            }

        }

    }

i have record in my table for my second stmt, but here i doesn't give my any result all my code is correctly written(mean i didn't have spelling mistake related to db or tb name), when i manually check it on phpmyadmin it responsed with some result. Please help me. i am struggling with my code for last 4-5 hours

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 求差集那个函数有问题,有无佬可以解决
    • ¥15 【提问】基于Invest的水源涵养
    • ¥20 微信网友居然可以通过vx号找到我绑的手机号
    • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
    • ¥15 解riccati方程组
    • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
    • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
    • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
    • ¥50 树莓派安卓APK系统签名
    • ¥65 汇编语言除法溢出问题