Problems creating a user in MySQL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux