mysqli Prepared语句在Count条件下从多列获取多行

时间:2018-07-17 19:37:27

标签: mysqli count prepared-statement multiple-columns

我不熟悉准备好的声明。

我需要您的帮助才能从此代码获取结果:

<?php
    $hx10c = "%{$metur}";
    echo 'Service id- '.$svid;
    $query = $dbfrli->prepare("SELECT `uid`, `name`, `lastname` FROM `bussiness` WHERE `type` like ? AND `uid` >= ?");
    $query->bind_param("ss", $hx10c, $svid);
    $query->execute();
    $query->store_result();
    //$query->bind_result($hx11c, $hx12c, $hx13c);// bind result variables
    $numrows = $query->num_rows;
    //echo 'Row count- '.$numrows;
    echo "<br>";
    $count = 1 ;
    while($row_data = $result->fetch_assoc()){
        if($count<=3){
            $uid[] = $row_data['uid'];
            $name[] = $row_data['name'];
            $lastname[] = $row_data['lastname'];
        }
        $count++;
    }
    if($numrows == 1){
        $ids = '1035';
        $names = 'Aniket';
        $lastnames = 'Astrologers';
    }
    elseif($numrows == 2){
        $ids = $uid[1];
        $names = $name[1];
        $lastnames = $lastname[1];
    }
    elseif($numrows == 3){
        $ids = $uid[2];
        $names = $name[2];
        $lastnames = $lastname[2];
    }
?>

我需要上面代码中“行数条件”的结果。

谢谢!

0 个答案:

没有答案