Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

PDO db_affected_rows Topic is solved

Questions related to customising nuBuilder Forte with JavaScript or PHP.
Post Reply
tsignadze
Posts: 43
Joined: Tue Feb 21, 2023 12:14 am
Has thanked: 22 times
Been thanked: 1 time

PDO db_affected_rows

Unread post by tsignadze »

Hello, do we have a possibility to use db_affected_rows? Wiki says following are supported:
1 db_fetch_array
2 db_fetch_object
3 db_fetch_row
4 db_field_names
5 db_num_columns

I want to count how many rows have been affected after UPDATE query has been run.

If not implemented yet, can we get it?
tsignadze
Posts: 43
Joined: Tue Feb 21, 2023 12:14 am
Has thanked: 22 times
Been thanked: 1 time

Re: PDO db_affected_rows

Unread post by tsignadze »

EDIT

worked around it :

Code: Select all

nuRunQuery($sql);

$affected_rows = nuRunQuery("SELECT ROW_COUNT()")->fetchColumn();

if ($affected_rows > 0) {
  $js = "nuMessage('Good!', 2000,closePopup);

	function closePopup() {
		nuClosePopup();
	}
	";
} elseif ($affected_rows === 0) {
  $js = "nuMessage('BAD');";
} else {
  nuDisplayError('WRONG!!!');
  return;
}

nuJavaScriptCallback($js);
kev1n
nuBuilder Team
Posts: 4292
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 444 times
Contact:

Re: PDO db_affected_rows

Unread post by kev1n »

You can use db_num_rows()
Post Reply