我不理解fetch函数的概念.
我正在从'PHP解决方案'一书中做一个教程,我正在使用MySQL Improved来更新数据库中的内容.
这是代码:
if (isset($_GET['article']) && !$_POST) {
$sql = 'SELECT article_id, title, article
FROM journal WHERE article_id = ?';
$stmt = $conn->stmt_init();
if ($stmt->prepare($sql)) {
$stmt->bind_param('i', $_GET['article_id']);
$stmt->bind_result($article_id, $title, $article);
//execute the query, and fetch the result
$OK = $stmt->execute();
$stmt->fetch();
}
}
Run Code Online (Sandbox Code Playgroud)
那么fetch实际上做了什么?我认为execute()函数将信息发送到数据库,然后它返回$ OK变量的true/false值.
fetch()是否在$ stmt中存储了什么?有人知道它在做什么吗?