Friday, May 15, 2009

Updating database in mysql using php

$Userid = $_POST['User_id'];
$Username = $_POST['User_name'];
$Userpassword = $_POST['User_password'];

mysql_connect("localhost","root","") or die ('Error: ' . mysql_error());
mysql_select_db("it");

$query = "UPDATE users SET User_id='".$Userid."', User_name='".$Username."', User_password='".$Userpassword."' WHERE User_id='".$Userid."'";

mysql_query($query) or die ('Error updating user');

echo "User updated with: " .$Userid. " " .$Username. " " .$Userpassword;


?>

No comments: