Why can't I write my code to the database? I have a registration system with a submission page that uploads the input information from the submission page to another PHP for writing. But I don't know how, I can't write ...... My code is & lt ;? Phprequire_once (... configconfig_database.php); $ name $ _ POST [name]; $ ccid: why can't my code be written to the database?
I made a registration system with a submission page that uploads the input information from the submission page to another PHP file for writing. But I don't know how, I can't write ......
My code is
Require_once ("../config/config_database.php ");
$ Name = $ _ POST ['name'];
$ Cid = $ _ POST ['CID'];
$ Xh = $ POST ['xh'];
$ Tel = $ POST ['tel'];
$ Bx = $ POST ['bx '];
$ Exec = "insert into xx values ($ name, '$ Cid', $ xh,' $ tel ', $ bx )";
$ Result = mysql_query ($ exec );
If ($ result)
{
Echo "you have registered successfully ";
}
Else
{
Echo "Sorry, database writing failed. please register again! ";
}
Mysql_close ();
?>
Please enlighten me.
------ Solution --------------------
$ Result = mysql_query ($ exec) or die (mysql_error (); // if this error is returned, no
------ Solution --------------------
$ Exec = "insert into xx (corresponding fields in the database, without quotation marks) values ('$ name',' $ Cid', $ xh, '$ tel ', '$ bx ')";