Yahoo Poland Wyszukiwanie w Internecie

Search results

  1. ON DUPLICATE KEY UPDATE field1='value1', field2='value2', field3='value3', ... Note: With ON DUPLICATE KEY UPDATE , the affected-rows value per row is 1 if the row is inserted as a new row, 2 if an existing row is updated , and 0 if an existing row is set to its current values .

  2. PHP MYSQL UPDATE if Exist or INSERT if not? You can use the ON DUPLICATE KEY UPDATE statement in your MySQL query when using PHP's mysqli or PDO libraries to accomplish this. For example, using the mysqli library: $sql = "INSERT INTO table (column1, column2, column3) VALUES (?, ?, ?)

  3. 4 mar 2010 · IF EXISTS(SELECT * FROM shares WHERE file_id='1' AND user_id='4') THEN UPDATE shares SET shared='1' WHERE file_id='1' AND user_id='4'; ELSE INSERT INTO shares (id, file_id, user_id, shared) VALUES (NULL, '1', '4', '1') ; END IF

  4. 29 kwi 2015 · IF EXISTS (select * from users where username = 'something') THEN. update users set id= 'some' where username = 'something'; ELSE. insert into users (username) values ('something'); END IF; end $$. delimiter ; and call it like this: call select_or_insert();

  5. 2 lut 2024 · Use REPLACE INTO to Update the Record if It Exists Else Insert It in the MySQL Table. One approach is to use the REPLACE statement if you want to truly replace rows when the INSERT commands would fail due to duplicate UNIQUE or PRIMARY KEY values as described previously.

  6. 14 sty 2024 · This code checks if a user with the given email exists and updates the name if it does. Otherwise, it creates a new User entity and persists it to the database.

  7. 19 lut 2017 · IF EXISTS (SELECT network_contract_id FROM network_contracts WHERE phone_number = 123456 AND user_id = 1) UPDATE network_contracts SET verification_pin = 9891 WHERE user_id = 1 ELSE INSERT INTO network_contracts(user_id, phone_number, contract_type, verification_pin) VALUES (1, 123456, 'Sim Only', 7676)

  1. Ludzie szukają również