12.05.2013, 12:18
I'm afraid I do not really understand your first question. You can write a constraint in the form of
Not sure if that's what you want.
Second question; yes you may write something like that but it won't be very efficient if you're going to update multiple values at a time.
Third question; mysql_real_escape_string should be used for any and all user input. http://en.wikipedia.org/wiki/SQL_injection
PHP код:
INSERT INTO table (string1, string2, number) VALUES ('foo', 'bar', 42) ON DUPLICATE KEY UPDATE number = 43;
Second question; yes you may write something like that but it won't be very efficient if you're going to update multiple values at a time.
Third question; mysql_real_escape_string should be used for any and all user input. http://en.wikipedia.org/wiki/SQL_injection