I used the following code for inserting form data into "userinfo" table of "user" database.The database and table was created on xampp(phpmyadmin).But the page displayed "Error: No database selected".... why?pls help..


<?php
$con = mysql_connect("localhost","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}

mysql_select_db("user",$con);

$sql="INSERT INTO userinfo(id,pass)
VALUES
('$_POST[UID]','$_POST[pass]')";

if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record added";

mysql_close($con);
?>