2 days racking my brain to implement a basic validation. I created a unique index in SQL Server for firstName, lastName to be unique. But leave it only in database results in a horrible error messagem to the user. I needed too a form validation when fistName, lastName would be duplicated. Whed adding is easy. The problem is when editing. Imagine these names: Jesus Christ Jesus Christ 2 Jesus Christ 3 You enter to edit 'Jesus Christ 2' e change to 'Jesus Christ' The validation can't accept, would be duplicate But if you change again to 'Jesus Christ 2', needs accept In other words, can't accept if the MemberID is DIFFERENT than the current id if the MemberID is equal than the current id, IS NOT DUPLICATE the problem is, when validation detected a real duplicate, the id (MemberID) was lost after 2 days of debugging, I found the solution adding the below line (MemberID...) $userData = array( 'MemberID' => $MemberID, 'FirstName' => $FirstName, 'LastName' => $LastName, 'Email' => $Email, 'Country' => $Country ); shure, also the code of validation against database and creating a variable $MemberID2 (if adding, $MemberID2 = 0 if editing, $MemberID2 = $MemberID)
That was the best PDO explanation on MSSQL I have ever seen! THANK YOU!!!
thanks for this Useful tutorial
Would be extremely useful a video with pagination and filters
Thanks for dedicate time to make this video and this tutorial. However in the website the php files are incomplete, missing some HTML code.
thanks!!! Very helpful!!!
Very useful 👌
Thanks make Big Project using MsSQL server and php
so good
2 days racking my brain to implement a basic validation.
I created a unique index in SQL Server for firstName, lastName to be unique.
But leave it only in database results in a horrible error messagem to the user.
I needed too a form validation when fistName, lastName would be duplicated.
Whed adding is easy.
The problem is when editing.
Imagine these names:
Jesus Christ
Jesus Christ 2
Jesus Christ 3
You enter to edit 'Jesus Christ 2' e change to 'Jesus Christ'
The validation can't accept, would be duplicate
But if you change again to 'Jesus Christ 2', needs accept
In other words, can't accept if the MemberID is DIFFERENT than the current id
if the MemberID is equal than the current id, IS NOT DUPLICATE
the problem is, when validation detected a real duplicate,
the id (MemberID) was lost
after 2 days of debugging, I found the solution adding the below line
(MemberID...)
$userData = array(
'MemberID' => $MemberID,
'FirstName' => $FirstName,
'LastName' => $LastName,
'Email' => $Email,
'Country' => $Country
);
shure, also the code of validation against database
and creating a variable $MemberID2
(if adding, $MemberID2 = 0
if editing, $MemberID2 = $MemberID)