Strange error in PHP/MySQL
| From: | Deckard | Date: | Sun, 01 Oct 2006 18:59:08 +0000 |
| Subject: | Strange error in PHP/MySQL | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-242444@lists.php.net to get a copy of this message | ||
Hello,
I have this code:
// 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-' for key 1"
I can't see nothing wrong with it and if i run it in MySQL's prompt
everything's fine.
Any ideas ?
Besta Regards,
Deckard.