【问题标题】:Replacement for mysqlnd supported codes替换 mysqlnd 支持的代码
【发布时间】:2016-06-21 07:48:53
【问题描述】:

所以我已经使用 mysqli 准备好的语句完成了我的整个项目。现在我的托管服务提供商说“我们的云服务器不支持 mysqlnd”。 我的代码看起来像

$stmt = $con->prepare("SELECT * FROM hr_admin WHERE email = ? AND password = ? ");
$stmt->bind_param('ss', $_POST['username'], $_POST['password']);
$stmt->execute();
$result = $stmt->get_result();
if ($result->num_rows > "0")
{
$member = $result->fetch_assoc();

我真的需要这个代码的替代品。请不要标记为重复,因为我搜索了整个但找不到合适的替代品。我得到了 get_result()$result->fetch_assoc(); 的替代品,但不是 ($result->num_rows > "0") 的替代品。我想使用PDO,但因为我的整个项目都在其中。我非常需要帮助。

【问题讨论】:

    标签: php mysqli pdo prepared-statement


    【解决方案1】:

    你不需要$result->num_rows > "0" 的替代品,因为你根本不需要这个条件:

    $result = $stmt->get_result();
    $member = $result->fetch_assoc();
    if ($member)
    {
    

    【讨论】:

    • $result = $stmt->get_result(); $member = $result->fetch_assoc(); 有些不工作
    • 您在问题中说您“得到了 get_result() 和 $result->fetch_assoc(); 的替代品”请问你能下定决心吗?
    • 是的,发表评论后知道了
    • link 我指的是这个,但它不起作用..
    • 所以你想要一个魔杖,它可以让你的代码在没有任何重写、安装 mysqlnd 或任何其他工作的情况下工作?祝你搜索顺利——我只能说这些了。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-09-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多