<?php
$con = mysql_connect("localhost:3306","root","");
try
{
if (!$con)
{
die('Could not connect to MySql Server : ' . mysql_error());
}
$db_found = mysql_select_db("registerdb");
if ($db_found)
{
print "Database Found";
}
else
{
print "Database NOT Found";
}
mysql_query("INSERT INTO register VALUES ('$_POST[Field2]','$_POST[Field4]','$_POST[Field7]','$_POST[Field8]','$_POST[Field9]','$_POST[Field13]','$_POST[Field14]','$_POST[Field15]')");
mysql_close($con);
}
catch(Exception $e)
{
echo 'Message: ' .$e->getMessage();
}
?>
I am not getting any error at run time, select query working fine for same database. Here is the table defination for register
Name Type Null Key
id bigint(10) NO PRI auto_increment
sname varchar(20) NO
dob date YES NULL
email varchar(30) NO
gender varchar(7) NO
mobile int(10) YES
country varchar(15) NO
state varchar(15) YES
city varchar(15) YES
I am not getting any sysntax error in php.
Sorry for my mistakes, I edited it.