Please help a big brother and sister to cry.

Source: Internet
Author: User
Please help a big brother and sister to cry.



Untitled Document



Echo" ";
Include "check_admin.php ";
Echo "add question bank

\ N ";
If (! $ _ POST ["type"])
{
?>






}
Else if (! $ _ POST ["content"])
{
?>



}
Else
{

Include "config. php ";
$ Type = $ _ POST ["type"];
$ Content = $ _ POST ["content"];
$ Answer = $ _ POST ["answer"];
If ($ type! = 1)
{
$ SQL = "INSERT INTO $ db_examsystem_question (content, type, answer) VALUES ('$ conten', '$ type',' $ answer ')";
$ Result = mysql_query ($ SQL, $ my_con) or die (mysql_error ());
If ($ result)
{
Echo "successfully added question bank ";
Echo "Click here to return ";
}
Else echo "an error occurred while adding a question bank ";
}
Else
{
$ Check = $ _ POST ["check"];
$ SQL = "INSERT INTO $ db_examsystem_question (content, type) VALUES ('$ content',' $ type ')";
$ Result = mysql_query ($ SQL, $ my_con) or die (mysql_error ());
$ Question_id = mysql_insert_id ();
$ Sql2 = "insert into $ db_examsystem_answer (content, question, answer) VALUES ";
For ($ I = 0; $ I <4; $ I ++)
{
$ Sql2 = $ sql2 ."(";
$ Sql2 = $ sql2. "'". $ answer [$ I]. "',";
$ Sql2 = $ sql2. $ question_id ."'";
If ($ check = $ I) $ sql2 = $ sql2. "1 )";
Else $ sql2 = $ sql2. "0 )";
If ($ I <3) $ sql2 = $ sql2 ."'";
}
$ Result2 = mysql_query ($ sql2, $ my_con) or die (mysql_error ());
If ($ result and $ result2)
{
Echo "successfully added question bank ";
Echo "returns from a single machine ";
}
Else echo "an error occurred while adding a question bank ";
}
}
Echo" ";
?>

This is an online Q & A system assigned by the teacher. I wrote this part to add the question Library. However, after I click the last confirmation button, it does not jump to the database statement. he always returns to the previous step, that is, I cannot. I have been bothering you for a week to save the written question content to the database. thank you!


Reply to discussion (solution)

123123

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.