A
A
Arthur2014-11-19 05:43:27
PHP
Arthur, 2014-11-19 05:43:27

How to display forms for submitting data to the database on one page after changing the data base locations?

Greetings! Please tell me how to link forms (for sending numbers to database fields). If, I changed the field locations. For example, the data was taken from the pays table (where all data was entered into a new column and id 1 was for everyone in a row), and now the columns are tied to the sites table and mapped to id, respectively. Clarification: the form data (for input) must be on the same page.

<h5>СТАТИСТИКА по ПЕРЕПРАВЕ</h5>
<form action="" role="form" method="POST" style="float: left;">Вложено:  <input name="up_1" type="text" size="8" maxlength="8" class="summ" value=""></form>
<form action="" role="form" method="POST" style=" float: left; padding-left: 20;">Выведено: <input name="down_1" type="text" size="8" maxlength="8" class="summ" value=""></form>
<br>
<br>
<br>
<h5>СТАТИСТИКА по INDASTRIES</h5>
<form action="" role="form" method="POST" style="float: left;">Вложено:  <input name="up_2" type="text" size="8" maxlength="8" class="summ" value=""></form>
<form action="" role="form" method="POST" style=" float: left; padding-left: 20;">Выведено: <input name="down_2" type="text" size="8" maxlength="8" class="summ" value=""></form>

$up_1 = protect($_POST['up_1']);
$up_2 = protect($_POST['up_2']);
$down_1 = protect($_POST['down_1']);
$down_2 = protect($_POST['down_2']);

# приплюсовываются значения
$db = mysql_query("UPDATE pays SET up_1=up_1+'$up_1', up_2=up_2+'$up_2', up_3=up_3+'$up_3', up_4=up_4+'$up_4', down_1=down_1+'$down_1', down_2=down_2+'$down_2', down_3=down_3+'$down_3', down_4=down_4+'$down_4' WHERE id = '1'");

And now we need to bind all this to the sites table where there are up and down, and the values ​​​​are tied to id. That is, all values ​​are not in a line, but in two columns. I have no idea how to set it up on one page.
If so:
$db = mysql_query("UPDATE sites SET up=up+'$up', down=down+'$down', WHERE id = '$id'");

So where to assign $id - so that he understands that this is data for a specific site?
642f0949eda34ac9a2f20dbe4d174d72.png
There was a conclusion from such a table,
1cfafe081b3943508ec4a6216f1053c2.png
and now this is how the data is located (and how now to display the correspondence of all these values ​​​​on one page?)
338ed35120bb4ff2b46b1d6a48724362.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Entelis, 2014-11-19
@DmitriyEntelis

That is, all values ​​are not in a line, but in two columns
Please learn to express your thoughts. In "two columns" and "in line" is the same thing.
Again, when asking a question, it would not be superfluous to show the structure of the tables of all, give an example of what should happen after saving.
Edit your question, please, now it's not clear what you need.

A
Artur, 2014-11-20
@arturka_v_10

If you compress all this, then the point is that everything should be displayed in exactly the same way, only from a table of the form:
id | in | out |
1 | 100 | 62 |
2 | 100 | 0 |
not
id | in_1 | in_2 | out_1 | out_2 |
1 | 100 | 100 | 62 | 0 |
like now

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question