On Sun, October 1, 2006 3:48 pm, Deckard wrote: > I have this code: > ------------------------------------------------------- > // use mysql database > mysql_select_db('mysql') or die('Cannot select MySQL database.' . > mysql_error()); > > // insert new user in mysql user table > $sqlInsertUser = "INSERT INTO user (Host, User , Password , > Select_priv, Insert_priv, Update_priv, Delete_priv) VALUES > ('$hostname', > '$mysql_username', '$mysql_password', 'N', 'N', 'N', 'N')"; > > if (mysql_query($sqlInsertUser, $conn)) > $messagesqlInsertUser = 'Success...'; > else > $messagesqlInsertUser = 'Error: ' . mysql_error(); > $result = mysql_query($sqlInsertUser); > ------------------------------------------------------- > > that gives me the error: > --------------------------------------------------- > Error: Duplicate entry 'localhost-gamito' for key 1 > --------------------------------------------------- > > although the pair 'localhost-gamito' is not duplicated and i can be > assured os this, because it works perfectly well in the MySQL prompt. Once you have put the user 'gamito' in to that table, with the host 'localhost', you cannot add a SECOND user 'gamito' for 'localhost' because there is a UNIQUE KEY constraint on that 2-field combination. You could add '%', 'gamito' or you could add 'localhost', 'gamito2' but not another 'localhost', 'gamito' I'm also going to wonder aloud why you are doing this when there are a plethora of tools available to manipulate the MySQL user table... -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php