Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add warning about using sql_affectedrows() #291

Merged
merged 2 commits into from
Jul 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions development/db/dbal.rst
Original file line number Diff line number Diff line change
@@ -383,6 +383,13 @@ Example:

$affected_rows = $db->sql_affectedrows();

.. warning::
Be cautious when using ``sql_affectedrows()`` to determine the number of rows affected by your query, especially with **SELECT** queries.
This function's behavior can differ depending on the used database driver and whether the query was cached.

Do not rely solely on ``sql_affectedrows()`` to confirm the number of impacted rows. Consider alternative approaches
like checking the number of rows returned by `sql_fetchrow`_ or `sql_fetchrowset`_.

sql_nextid
----------
Retrieves the ID generated for an AUTO_INCREMENT column by the previous INSERT query.