Table Fields MSQli Variables?

0

I have to fill in a table, with data collected from a form. The problem is that I do not know which field of the table will be modified, until I receive the PHP variable. Exactly:

$updatewin = "UPDATE live_chess SET Round1='1' WHERE Team='$TeamWin'";

But I do not know that Round will come in the form via PHP, and I have 50 Roundx fields !!!! Any help?

    
asked by Mario Campos 05.11.2018 в 06:28
source

2 answers

0

You must first assign a name to the input where you will enter the data to be captured ... With a form method post then where you will do the query you capture the form variable something like $ varinput = $ _POST ['input name']; then you use the variable $ varinput in the update something like ..

  

$ updatewin="UPDATE live_chess SET Round1 = '$ varinput' WHERE Team = '$ TeamWin'";

    
answered by 05.11.2018 в 07:22
0

Searching, I found in Google a response that works very well. I share it here, maybe it helps someone:

$updatewin = "UPDATE live_chess SET $Round='1' WHERE Team='$TeamWin'";

Where the name of the table field, $ Round is a PHP variable obtained from the form.

    
answered by 10.11.2018 в 05:48