I am not sure why you get this error message, but are you sure about the permsissions? i.e. does this user have permission to write to the MYSQL database and user table? Prathap ---------- Original Message ----------- From: Deckard <ml@xxxxxxxxxxx> To: php-general@xxxxxxxxxxxxx Sent: Sun, 01 Oct 2006 21:48:21 +0100 Subject: Problems creating a user in MySQL > Hello, > > 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. > > Can someone help me, please ? > > Best Regards, > Deckard > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php ------- End of Original Message ------- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php