hi
i want to know whether my coding is correct because data is not getting inserted in my sql table,but it is displaying the "data inserted" message<html>
<head></head>
<body>
<?php
$uname1= $_POST;
$cname=$_POST;
$caddr=$_POST;
$mid=$_POST;
$skills=$_POST;
$degree=$_POST;
$indtype=$_POST;
$desc=$_POST;
$req=$_POST;
$yoe=$_POST;
$sal2=$_POST;
$search=$_POST;
$hostname = "localhost";
$username = "uname";
$password = "godcares";
$dbid = "splendor_samp";
$link=mysql_connect($hostname, $username, $password);
mysql_select_db($dbid) or die("unable to connect");

if (isset($_REQUEST["Submit"]))
{
mysql_query("INSERT INTO postreq(uname,cname,caddr,mailid,skills,degree,indtype,desc,req,yoe,sal,searchdate)VALUES('$uname1','$cname','$caddr','$mid','$skills','$degree','$indtype','$desc','$req','$yoe','$sal2','$search')");
echo "data inserted";
}
else
{
echo "ERROR: ".mysql_error();
}
mysql_close($link);
?>
</body>
</html>

hi
it is displaying error message like this
RROR:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'desc,req,yoe,sal,searchdate)VALUES('jhj','hjhg','hjhg','hjghj','hjhj','hjhj','hj' at line 1

Have you tried running your query in MySql?I think the problem there is the query itself,e.g. wrong fields,wrong field type,etc.for example your searchdate is supposed to be a date therefore you must enter a date.Try to check on this one.

thanks for your reply ...i found the error...desc is a key word in sql...i have given the name to my field in the table......

This question has already been answered. Start a new discussion instead.