How to add a form to a table and submit a MYSQL database

Source: Internet
Author: User
How to add a form to the table and submit the MYSQL database is a newbie. now I want to create a metric submission system, and the MYSQL database has an overall sales architecture, in PHP, corresponding sales subordinates are automatically generated according to the login account. However, the architecture follows the sales indicator and you want to create an input box and submit it to the database. how can this problem be solved: architecture & nbsp; & nb: how to add a form to a table and submit a MYSQL database
I am a newbie. now I want to create a metric submission system. the MYSQL database already has an overall sales architecture and has automatically generated corresponding sales subordinates in PHP according to the login account, however, the architecture follows the sales indicator and you want to create an input box and submit it to the database. how can this problem be solved:

Architecture profit
-L4: Shanghai wedding yellow supervisor input box
-L3: Enter the "Shen supervisor" text box for Shanghai Wedding Group 2
-L2: MA supervisor input box for Shanghai 2-1 wedding Group
L1: Sun sales input box
L1: du sales input box
L1: Li sales input box


$ Q = $ _ POST ["employeenumber"];

$ Con = mysql_connect ('localhost', 'root ','');
If (! $ Con)
{
Die ('could not connect: '. mysql_error ());
}

Mysql_select_db ("org", $ con );

Echo"















";$ SQL = "SELECT architecture, profit FROM 'org 'WHERE Supervisor id ='". $ q ."'";$ Result = mysql_query ($ SQL );While ($ row = mysql_fetch_array ($ result )){Echo" ";Echo" ";Echo" ";}Echo"
Architecture Profit
". $ Row ['struct']."
";

Mysql_close ($ con );
?>

------ Solution ----------------------
I modified it on your infrastructure. The idea is as follows: submit it with the id of the table store.
Index. php

$q=$_POST["employeenumber"];

$con = mysql_connect('localhost', 'root', '');
if (!$con)
{
die('Could not connect: ' . mysql_error());
}

mysql_select_db("org", $con);

echo '';
mysql_close($con);
?>


Add. php

$ Con = mysql_connect ('localhost', 'root ','');
If (! $ Con)
{
Die ('could not connect: '. mysql_error ());
}

Mysql_select_db ("org", $ con );

$ Employeenumber = $ _ POST ["employeenumber"];

$ SQL = "SELECT id, architecture, profit FROM 'org 'WHERE Supervisor id ='". $ q ."'";

$ Result = mysql_query ($ SQL );

While ($ row = mysql_fetch_array ($ result ))
{
If ($ _ POST ['yl '. $ row ['id']) {
$ Sqlstr = "update 'org 'set profit = '". $ _ POST ['yl '. $ row ['id']. "'Where id = '". $ row ['id']. "'"; // update the database
Mysql_query ($ sqlstr) or die (mysql_error ());
}
}

Mysql_close ($ con );

Header ('Location: index. php? Q = '. $ employeenumber); // jump back to worker
?>

------ Solution ----------------------
24 rows
Profit = '"$ _ POST ['yl'. $ row ['id'].]" 'Where
Change
Profit = '". $ _ POST ['yl'. $ row ['id']." 'Where


------ Solution ----------------------

This post was last edited by xuzuning at 18:33:58

$ Sqlstr = "update 'org 'set profit ='" $ _ POST ['yl '. $ row ['id'].] "'Where id = '". $ row ['id']. "'";
Should be
$ Sqlstr = "update 'org 'set profit = '". $ _ POST ['yl '. $ row ['id']. "'Where id = '". $ row ['id']. "'";

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.