如果我没有在正确的地方发布,我深表歉意。我想知道我是否正确地转换了这个。我正在尝试在PDO中转换我的所有代码。
这是mySQLi:
$stmt->execute();
$stmt->bind_result($timestamp);
$stmt->fetch();
$stmt->close();
return ($timestamp);
我把它改成:
$stmt->execute();
$timestamp = $stmt->fetch();
return ($timestamp);
有人能告诉我我做得对吗?
假设$stmt
是您的连接参数。。。然后
$query = $stmt->prepare("SELECT * FROM table");
$query->execute();
$timestamp = $query->fetchAll();
举一个你会了解的例子。。。
或
$query = $stmt->query("select * from table");
$timestamp = $query->fetch();