Re: Strange error in PHP/MySQL

From: Date: Wed, 04 Oct 2006 07:35:31 +0000
Subject: Re: Strange error in PHP/MySQL
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-242602@lists.php.net to get a copy of this message
On Sun, 01 Oct 2006 19:59:08 +0100, Deckard wrote: > 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. Hi, Wouldn't it be easier to just use the MySQL GRANT statement? Ivo

« previous php.general (#242602) next »