Example #2 Counting rows returned by a SELECT statement For most databases, PDOStatement::rowCount() does not return the number of rows affected by a SELECT statement. Instead, use PDO::query() to issue a SELECT COUNT(*) statement with the same predicates as your intended SELECT statement, then use PDOStatement::fetchColumn() to retrieve the number of rows that will be returned. Your application can then perform the correct action.大意是,你可以变通一下,在SQL语句中使用 count(*) as rowcount。然后通过PDO获取其行数考虑到效率你可以先fetchAll(),然后直接用PHP的函数count()来计算查询结果集转换为数组后的单元数
登录的时候把账号密码都赋值给session了
那有会员才能访问的页面是否需要把session再入库查询账号密码是否正确吗
cookies呢
For most databases, PDOStatement::rowCount() does not return the number of rows affected by a SELECT statement. Instead, use PDO::query() to issue a SELECT COUNT(*) statement with the same predicates as your intended SELECT statement, then use PDOStatement::fetchColumn() to retrieve the number of rows that will be returned. Your application can then perform the correct action.大意是,你可以变通一下,在SQL语句中使用 count(*) as rowcount。然后通过PDO获取其行数考虑到效率你可以先fetchAll(),然后直接用PHP的函数count()来计算查询结果集转换为数组后的单元数