Insert data into mysql using php

Source: Internet
Author: User
Tags mysql insert
Php operation mysql insert data MySQL PHP HTML

1. the html code is saved in table_arr. Displays a table on a webpage.
2. the fields of the code segment saved in table_arr [] in the database use the text type.
My problem is that you cannot perform the insert operation if you have one more content to save $ table_arr [], such as outstanding_thesis_tab. Otherwise, you can. I want to know where the problem is.

$ First_step = "insert into lw_process (values, dic_id, t_stu_select_title, p_stu_select_title, values, t_open_title, p_open_title, values, values, t_mid_check, p_mid_check, values, values, t_input_score, p_input_score, now_statue, final_statue, author_promise_tab, ter_promise_tab, metrics, complex_score_tab, metrics, metrics) values (". $ _ POST ['User _ num']. ",". $ _ POST ['dic _ id']. ",'". $ time_arr ['t _ stu_select_title ']. "', 0 ,'". $ time_arr ['t_ter_select_stu ']. "', 0 ,'". $ time_arr ['t _ stu_select_ter ']. "', 0 ,'". $ time_arr ['t_ open_title ']. "', 0 ,'". $ time_arr ['t_ sub_original_ver ']. "', 0 ,'". $ time_arr ['t_ mid_check ']. "', 0 ,'". $ time_arr ['t_ sub_final_ver ']. "', 0 ,'". $ time_arr ['t_ input_score ']. "', 0, 0 ,'". $ table_arr ['author's commitment to certificate']. "','". $ table_arr ['Instructor commitment certificate']. "','". $ table_arr ['opening report Table']. "','". $ table_arr ['medium-term check status']. "','". $ table_arr ['Checklist for mid-term checkpoint']. "','". $ table_arr ['graduation thesis (design) instructor score evaluation Table']. "','". $ table_arr ['Instructor evaluation score evaluation Table']. "','". $ table_arr ['Defense score Table']. "','". $ table_arr ['overall score evaluation Table']. "','". $ table_arr ['answer record Table']. "','". $ table_arr ['excellent thesis recommendation Table']. "')";
$ First_step_rec = mysql_query ($ first_step, $ conn );


Reply to discussion (solution)

$ First_step_rec = mysql_query ($ first_step, $ conn) or die (mysql_error (); // The error message returned.

$ First_step_rec = mysql_query ($ first_step, $ conn) or die (mysql_error (); // The error message returned.
I cannot debug it now. the database is in the company. $ First_step_rec = mysql_query ($ first_step, $ conn ). After this statement is completed, $ first_step_rec uses isset to determine that the result is false.

Var_dump (). The isset cannot be false.

Var_dump (). The isset cannot be false.
$ First_step_rec = mysql_query ($ first_step, $ conn );
Well, it's not isset ();
My judgment statement is
If ($ first_step_rec)
Echo "OK ";
However, no results are output.

In your SQL command
The field list contains 31 fields.
The parameter list contains 30 items.
If they do not match, an error is returned.

In your SQL command
The field list contains 31 fields.
The parameter list contains 30 items.
If they do not match, an error is returned.
There are 31, so I can count 3. I wonder if the field content is too long. Here, the html code is saved in table_arr. Will there be too many tables and other restrictions? I am a newbie. this problem is troublesome. It cannot be done in two steps. This may occur when either 10 tables are inserted or two tables are inserted (I divide the table into 10 and the two tables are once ).

Ask you to post mysql_error (); the result will be clear.

Ask you to post mysql_error (); the result will be clear.
Thank you for reminding me, but the code has been destroyed. I learned mysql_error. I will pay attention to it next time.

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.