首页 > 解决方案 > PHP MySQLi:变量问题

问题描述

我在 github 上找到了一位 T 恤设计师,并一直在努力。我设法让客户功能插入数据库,但它没有将订单详细信息发布到数据库中。我收到此错误:

注意:未定义变量:第 73 行 G:\xampp\htdocs\tdesigner\php\send.php 中的 selectNumRows

虽然当我检查第 73 行的代码时,我看不出它有任何问题。

功能代码:

/* Get the number of rows and current customer information */
if ($selectCurrentCustomer = $mysqli->prepare($querySelect)) {
    /* Fetch the SELECT data */
    $selectCurrentCustomer->execute();
    $selectCurrentCustomer->bind_result($id);
    $selectCurrentCustomer->store_result();
    $selectCurrentCustomer->fetch();
    /* Store the customer ID and number of rows found */
    $selectNumRows = $selectCurrentCustomer->num_rows;
    $customerId = (selectNumRows == 0) ? $id : null;
    /* Close the query */
    $selectCurrentCustomer->close();
}

/* If not a returning customer, insert them into the database. Otherwise, update the existing customer */
if ($selectNumRows == 0) { //  LINE #73

我希望有人能在这方面帮助我。谢谢你。

标签: phpmysqli

解决方案


推荐阅读