With Php - mySQL Returning an error if insert value is not unique

0 votes
asked Mar 16, 2016 by AndBruen (170 points) 1 flag
Any help will be appreciated. I would like error to be outputted on addStudent. php page if combination of firstname and last name are in Student table.

4 Answers

0 votes
answered Apr 17, 2016 by Secundo (840 points)
Best answer

This set of changes allows the appropriate error message to get returned.
It should translate the internal error to an external error here. So the question is what error should it get.
More great aliases at MySQL Bugs: #22161: Duplicate key error with non-unique index after alter
commented Apr 17, 2016 by better_685 (540 points)
It can be found in detail in here
0 votes
answered Apr 25, 2016 by Gurmotes (330 points)

Logically, the select is evaluated before the actual insert operation is started.
If a column is not specified, the default value for the column is used.

So I agree with Insert (SQL) - Wikipedia, the free encyclopedia which has much deeper insight on this question
0 votes
answered May 26, 2016 by Guadagno (590 points)
This is as simple as this. I use Insert (SQL) - Wikipedia, the free encyclopedia to get that functionality
0 votes
answered Jun 2, 2016 by be_given (190 points)
As described here http://bugs.mysql.com/bug.php?id=22161
Would work for unequal row size

Related questions

0 votes
4 answers
0 votes
3 answers
0 votes
3 answers

What is Geekub?

Q&A site for professional and enthusiast programmers, software developers and other technical users. With your help, we hope to work together to build a library of detailed answers to just about any question that is related to programming!