Datbase Simple Insert Query
Posted: Wed Jul 02, 2003 12:29 am
[Admin Edit: removed host IP and password from mysql_connect() and added tags]
Hi
I have a simple INSERT query setup which works only once if I try to run the script again it fails.
But if I manually delete the last database entry I can then run the script again.???
Code: Select all
Hi
I have a simple INSERT query setup which works only once if I try to run the script again it fails.
But if I manually delete the last database entry I can then run the script again.???
Code: Select all
$username = $HTTP_POST_VARS['username'];
$password = $HTTP_POST_VARS['password'];
$username = addslashes($username);
$password = addslashes($password);
open the connection
$conn = mysql_connect("host", "express", "****");
if (!$conn)
{
}
mysql_select_db("central");
$query = "insert into login values(' $username ',' $password' )";
$result = mysql_query($query);
if($result)
echo mysql_affected_rows().' Password Entered';
mysql_close();