When I run this program I am getting this error-
Fatal error: Function name must be a string in D:\wamp\www\...\add.php on line 11
Line 11 is ok I think. I tried 'eid',then eid but none worked!!PHP Code:<html>
<head>
<title>Emp Add</title>
</head>
<body>
<?php
$eid=$_POST("eid");
$enm=$_POST('enm');
$sal=$_POST('sal');
?>
<form action="add.php" method="POST">
Enter emp id: <input type="text" name="eid"><br>
Enter emp name: <input type="text" name="enm"><br>
Enter salary: <input type="text" name="sal"><br>
<input type="submit" value="Enter"><br>
</form>
<?php
$con=mysql_connect('localhost','root','');
if(!$con)
{
die("Error:".mysql_error());
}
$db=mysql_select_db('db1',$con)
or die("error:".mysql_error());
$sql="insert into emp(emp_id,ename,salary) values('$eid','$enm','$sal')";
if(!mysql_query($sql,$con))
{
die('Error:'.mysql_error());
}
else
{
echo "Record Saved";
}
mysql_close($con);
?>
</body>
</html>
Pls help me,I can't figure it out.




Reply With Quote




Bookmarks