This is the connect. php file. this is the add. php file. mysql_query ($ SQL); if (mysql_query ($ SQL) {echo mysqlphp database
This is the connect. php file.
@ Mysql_connect ("localhost: 3306", "root", "123456") or die ("SQL connection failed"); @ mysql_select_db ("yhy ") or die ("yhy connection failed"); // mysql_query ("set names 'gb2312 '"); mysql_set_charset ("gbk ");
?>
This is the add. php file.
Include ("connect. php"); // introduce the database connection module
If (! Empty ($ _ POST ['sub'])
{
$ Title = $ _ POST ['title'];
$ Con = $ _ POST ['con '];
$ SQL = "insertYhy100(Id,Title,Dates,Contents) Values (null, '$ title', now (),' $ con ')"."
";
Mysql_query ($ SQL );
If (mysql_query ($ SQL ))
{
Echo "successful insertion ";
}
Else
Echo "insertion failed ";
}
?>
Title
Content
When I was a beginner in PHP, there was no problem connecting to the database, but every time I clicked "post", I was prompted that the insertion failed and I was always unable to insert the data into the database. such a small routine would have killed me, could you please advise me ....