Re: [PHP] preventing duplicate rows?

2006-04-13 Thread Georgi Ivanov
You have several opportunities here : 1.If you use mysql 4.1.x you can use "insert into .. on duplicate key update" (check the correct syntax) 2.You can make unique key from the two columns and check for error number 1062 (duplicate key) like this : myusql_query($qins) or $errno=mysql_errno();

Re: [PHP] preventing duplicate rows?

2006-04-13 Thread nicolas figaro
William Stokes a écrit : Hello, I'm updating a table with following SQL statement $sql = "INSERT INTO x_ikaluokat (ryhma, ikaluokka) VALUES ('$ryhma','$ikaluokka')"; What would be the best way to test that similar rows doesn't get created to the table? I can't make both columns unique.

Re: [PHP] preventing duplicate rows?

2006-04-13 Thread Chris
William Stokes wrote: Hello, I'm updating a table with following SQL statement $sql = "INSERT INTO x_ikaluokat (ryhma, ikaluokka) VALUES ('$ryhma','$ikaluokka')"; What would be the best way to test that similar rows doesn't get created to the table? I can't make both columns unique. You

[PHP] preventing duplicate rows?

2006-04-12 Thread William Stokes
Hello, I'm updating a table with following SQL statement $sql = "INSERT INTO x_ikaluokat (ryhma, ikaluokka) VALUES ('$ryhma','$ikaluokka')"; What would be the best way to test that similar rows doesn't get created to the table? I can't make both columns unique. Thanks -Will -- PHP Gener