Prepared Statements - Number of Rows

后端 未结 4 1604
旧巷少年郎
旧巷少年郎 2021-01-04 06:15

I\'m learning about prepared statements and trying to work with a query that yields multiple rows of results. Right now, I\'m just trying to figure out how to determine the

4条回答
  •  醉酒成梦
    2021-01-04 07:13

    Check out the example #2 here: PHP.net

    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.

提交回复
热议问题