命令不同步

时间:2014-05-04 15:40:48

标签: php mysqli

我正在尝试执行我的查询,但收到错误“命令不同步;您现在无法运行此命令”

这是我的代码:

public function user_info($dbusername)
        {
            if ($stmt = $this->mysqli->prepare("SELECT * FROM `accounts` WHERE `username` = ?")) {
                $stmt->bind_param("s", $dbusername);
                $stmt->execute();
                $stmt->store_result();
                //$stmt->free_result();
                if ($stmt->num_rows < 1) {
                    $stmt->close();
                    return false;
                }
                $meta = $stmt->result_metadata();
                while ($field = $meta->fetch_field()) {
                    $params[] = & $row[$field->name];
                }
                call_user_func_array(array($stmt, 'bind_result'), $params);
                $stmt->fetch();
                foreach ($row as $key => $val) {
                    $c[$key] = $val;
                }
                $stmt->free_result();
                $stmt->close();
                return $c;

            } else echo $this->mysqli->error;
            //return false;

        }

0 个答案:

没有答案