INSERT INTO `C301554_myroom`.`visitor` (
`Name` ,
`Address` ,
`City` ,
`State` ,
`Country` ,
`PIN` ,
`no_of_males` ,
`no_of_females` ,
`no_of_childrens` ,
`mail` ,
`Phone_no` ,
`Senior_Citizens` ,
`ID` ,
`date_from` ,
`date_to` ,
`Visitor_ID` ,
`Vehicle_No` ,
`Purpose`
)
VALUES (
'Jaspreet', 'D-66', 'Rohtak', 'HR', (
SELECT Country_Name
FROM country_code
WHERE Country_Code = "IN"
), '124001', '1', '1', '1', '', '2324342', 'Y', 'passport', '3/7/2011', '6/7/2011', 'null', '22', 'For Admission'
Above query is running on mysql but when i am trying to execute the query through php it is giving mysql error. -----here the code is------
$sql="INSERT INTO `C301554_myroom`.`visitor` (
`Name` ,
`Address` ,
`City` ,
`State` ,
`Country` ,
`PIN` ,
`no_of_males` ,
`no_of_females` ,
`no_of_childrens` ,
`mail` ,
`Phone_no` ,
`Senior_Citizens` ,
`ID` ,
`date_from` ,
`date_to` ,
`Visitor_ID`,
`Vehicle_No`,
`Purpose`
)
VALUES('$jName','$jAddress','$jCity','$jState',(select Country_Name from country_code where Country_Code=".$jcountry."),'$jpin','$jmale','$jfemale','$jchildren','$jemail','$jphone','$jSenior_Citizen','$jid','$jfrom','$jto','$RID','$jvehicle','$jpurpose')";
Country_Codeis string, so you should add quotes toCountry_Code='".$jcountry."'