SELECT * FROM user_clienti WHERE user_id =:user_id&#34 ;;

时间:2017-12-11 23:40:17

标签: php html ajax pdo

我尝试尽我所能,但现在我需要一些帮助: 我在显示查询时遇到问题,当我按下按钮(视图)时,我查看了没有我要求的值的空白表单 其他一切都有效(包括'添加''编辑' 发布代码和图像 enter image description here

    if($_POST['btn_action'] == 'product_details')
{
    $query = "
    SELECT * FROM user_clienti WHERE user_id = :user_id";
    $statement = $connect->prepare($query);
    $statement->execute(
    array(
            ':user_id'  =>  $_POST["user_id"]
        )
    );
    $result = $statement->fetchAll();
    $output = '
    <div class="table-responsive">
        <table class="table table-boredered">
    ';
    foreach($result as $row)
    {
        $status = '';
        if($row['user_status'] == 'Attivo')
        {
            $status = '<span class="label label-success">Attivo</span>';
        }
        else
        {
            $status = '<span class="label label-danger">Disattivo</span>';
        }
        $output .= '
        <tr>
            <td>Nome</td>
            <td>'.$row["user_nome"].'</td>
        </tr>
        <tr>
            <td>Stato</td>
            <td>'.$status.'</td>
        </tr>
        ';
    }
    $output .= '
        </table>
    </div>
    ';
    echo $output;
}

我无法识别所选的ID。如果查询

"SELECT * FROM user_clienti WHERE user_id = ':user_id'";

删除

= ':user_id'

告诉我一切 enter image description here

我也试过但没有尝试

SELECT * FROM user_clienti WHERE user_id = '".$_POST["user_id"]."'
    ";

We'll post the link to download the 3 file.php I can't place them here

帮助我,非常感谢

0 个答案:

没有答案