Ask the expert to check where the code below is wrong.
The code follows, adding a prompt to add a failure.
Phpinfo ();
This is a message to increase, delete, change the operation of the processing page
First, import the configuration file.
Require ("dbconfig.php");
Second, link MySQL, and select the database.
$link = @mysql_connect (Host,user,pass) or Die ("Database link Error! ");
mysql_select_db (DBNAME, $link);
Third, according to the value of action, to determine the operation, execute the corresponding code.
Switch ($_get["action"]) {
Case "Add"://Execute add
1. Get the information you want to add and supplement other information
$title = $_post["title"];
$keywords = $_post["keywords"];
$author = $_post["Author"];
$content = $_post["Content"];
$addtime = time ();
2, add information over filter (omitted)
3. Assemble and add SQL statements and perform add operations
$sql = "INSERT INTO news Valuse (null, ' {$title} ', ' {$keywords} ', ' {$author} ', ' {$addtime} ', ' {$content} ')";
Echo $sql; This step prints normally.
mysql_query ($sql, $link);
4, to determine whether to add success,
$id = mysql_insert_id ($link);//Determine the information ID value you just added
echo $id;
Break
if ($id >0) {
EchoAdd success
";
}else{
EchoAdd failed
";
}
Break
Case "Del"://Execute Delete
Break
Case "Update"://Perform modification
Break
}
Iv. Closing the database
Mysql_close ($link);
?>
------Solution--------------------
First paragraph: insert?into?news? Valuse
Second paragraph: INSERT INTO news Values
One is valuse and the other is valuse.