I have two tables:
candidate_register_table with the following schema:
|----------------------------------------------------|
|   username  |  name   |  age   | sex   | password  |
|----------------------------------------------------|
candidate_social_table with the following schema
|--------------------------------------------------------|
|   username  |  religion   | caste  | address   | city  |
|--------------------------------------------------------|
In both tables, username are primary keys in their corresponding table.
I want to insert data in both the table in a single click event, where the username in table candidate_register_table is a foreign key in candidate_social_table also
This is my reg_conn.php where the data are getting inserted:
<?php
include('connection.php')'
$sql_register="INSERT INTO candidate_register_table (username, name, age, sex, password) )           VALUES('$_POST[username]','$_POST[name]','$_POST[age]', '$_POST[sex]','$_POST[password]')";
$sql_social_disable="ALTER TABLE candidate_social_table disable CONSTRAINT fk_candidate_register_table";
$sql_social="INSERT INTO candidate_social_table (username) VALUES('$_POST[username]')";
$sql_social_enable="ALTER TABLE candidate_social_table enable CONSTRAINT fk_candidate_register_table";
if(mysql_query($sql_register,$con) && mysql_query($sql_social_disable,$con) && mysql_query($sql_social,$con)  && mysql_query($sql_social_enable,$con))
   { echo "you have been registered";
   }
else
   {
       die('Error: ' . mysql_error());
       echo "Something went wrong. Might be a Fatal Error";
   }
?>
Now the problem is that, my connection and all others are all working perfectly, but the query:
ALTER TABLE candidate_social_table disable CONSTRAINT fk_candidate_register_table`
Is not getting executed, its throwing the following error:
Error: 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 'CONSTRAINT fk_t1' at line 1
 
     
     
    