Retrieving the ID of newly-created user should not be done like this:
$select = $dbc->prepare("SELECT MAX(uid)+1 AS 'NEWUID' FROM mainTable");
Instead use PDO::lastInsertId()
But you are not using variable $addnewuid. So you are doing one query for nothing. Is your code complete and working as expected ? At the moment there is no firm relation ...
Does this appear as proper use of the commit and rollback functions?
I honestly haven't used PDO functions directly - typically used a framework like Laravel or similar.
I do agree with the advice on phpdelusions.net and it has a page about PDO usage with a section about Transactions. It mentions:
Please note the following important things:
PDO error ...
It is unfortunate that this post has existed more than three years without a review. In that time Laravel has had multiple major version releases. You may have learned a few things about it and perhaps your code is different. However even if the information below is not helpful to you then perhaps it may help others.
When this code was posted the latest ...