我使用sqlalchemy在MySQL中执行INSERT ... ON DUPLICATE KEY UPDATE,并尝试查找插入或更新的主键的。然而,当DUPLICATE子句被触发时,返回的是0,而我原以为它是刚更新的记录的主键。connection_string)
query = "INSERT INTO user (first_name, last_name) VALUES ('Jim', 'Brown') ON DUPLICATE KEY U
mysqli_connect("localhost", "ramendev_jctwood", "M1n1flam3", "ramendev_jctwood") or die ("Failed to connect to MySQLmysqli_query($con, "IF EXISTS (SELECT 1 FROM Users WHERE Userip='$userip')
UPDATE