Wednesday, May 13, 2009

Inserting data into mysql database using php



$Userid = $_POST['User_id']; //this is the column of table users
$Username = $_POST['User_name']; //
$Userpassword = $_POST['User_password']; //

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

$query = "INSERT INTO users (User_id,User_name,User_password) VALUES ('".$Userid."','".$Username."','".$Userpassword."')";

mysql_query($query) or die ('Error creating users');

echo "User Created With: " .$Userid. " " .$Username. " ".$Userpassword;

?>

No comments: