我不使用SQLite,但你看起来像你的
$numrows
正在检查执行是否已成功运行(
boolean true/false
). 尝试更新此位:
// I like to name "count" otherwise returned as "COUNT(*)" in the array key
$checkUser = $db->prepare('
SELECT COUNT(*) as count
FROM users
WHERE
user = ?
');
// Execute with bind
$checkUser->execute(array($user));
// Fetch an associative array
$result = $checkUser->fetch(PDO::FETCH_ASSOC);
// The count will be here as a numeric
if ($result['count'] == 0) {