The PHP form commits to update the contents of the database table, changing only when moving forward

Source: Internet
Author: User
Tags php form
In this attribute field, I gave a few values with select, how to select that value to commit to the database and update the contents of the table in the database, only change the forward


Reply to discussion (solution)

Passing Unique identification flags

Commit to modify the contents of the current row of the database

When modifying the database, the update is operated according to the submitted ID.

Passing Unique identification flags



How do I get the unique identity? JS is not very good, can you write a simple example?

Commit to modify the contents of the current row of the database

When modifying the database, the update is operated according to the submitted ID.



Know that, but how to get that ID, I just don't have this piece

You gave the only identification sign!
Assuming that your example data, QQ number is not duplicated, then QQ number can do a unique identification mark

You gave the only identification sign!
Assuming that your example data, QQ number is not duplicated, then QQ number can do a unique identification mark



I know the meaning of the only logo, I mean, how do I get that value, is to write JS? Or a form to get it?

You can use a checkbox to send a value to the form.

You can use a checkbox to send a value to the form.



Can you write a logic or knock a few lines of code? I'm a real cook, you just said I'm not very good at it.

is to add an ID-like field in the database structure, which should be the auto-generated ID value, that is, each time you create a piece of data will generate a unique ID value, and then use this ID to value the value, such as the update when the condition to write where id = 1 or a few

Then in the operation of the interface to give you the operation of the place an ID or name value, is the unique identifier, so your JS code should also have an ID value or name value and it is the same, JS write the method is to invoke or manipulate the database of things

is to add an ID-like field in the database structure, which should be the auto-generated ID value, that is, each time you create a piece of data will generate a unique ID value, and then use this ID to value the value, such as the update when the condition to write where id = 1 or a few



I know I'm going to do it, but I don't pass it, I don't get it. I can write a description of the function, let me refer to the best

#11

UPDATE table_name set ip=11.11.11.11 where qq=1234567;

#11

UPDATE table_name set ip=11.11.11.11 where qq=1234567;



I know this, I do not know the line of QQ how I get, because it is random, not fixed QQ


The top JS inside call Name=a or Id=a method
function A () {}


#11

UPDATE table_name set ip=11.11.11.11 where qq=1234567;



I know this, I do not know the line of QQ how I get, because it is random, not fixed QQ


So what's fixed in your database table? And which field are you going to change?



#11

UPDATE table_name set ip=11.11.11.11 where qq=1234567;



I know this, I do not know the line of QQ how I get, because it is random, not fixed QQ


So what's fixed in your database table? And which field are you going to change?



Change is the attribute that field Ah, QQ number is other conditions filtered out, because the QQ number is the only primary key, so you can get the QQ number in the row, and then form input attributes of the content, update the data table


In this attribute field, I gave a few values with select, how to select that value to commit to the database and update the contents of the table in the database, only change the forward


Also, you should add a value with insert? How do you interpolate with a select? It's a check, not an increase or a change.





#11

UPDATE table_name set ip=11.11.11.11 where qq=1234567;



I know this, I do not know the line of QQ how I get, because it is random, not fixed QQ


So what's fixed in your database table? And which field are you going to change?



Change is the attribute that field Ah, QQ number is other conditions filtered out, because the QQ number is the only primary key, so you can get the QQ number in the row, and then form input attributes of the content, update the data table


QQ number is there any other table? Did you find this watch or have it been saved?

You're checking this out, right? When displayed, the ID is also passed over, with an input type= "hidden" to save the ID,
After selecting the Select, after submitting the form, in PHP $_request the value out, and then update



In this attribute field, I gave a few values with select, how to select that value to commit to the database and update the contents of the table in the database, only change the forward


Also, you should add a value with insert? How do you interpolate with a select? It's a check, not an increase or a change.



Instead of using select in the database, the database is using INSERT INTO NewData (' attribute ') VALUES ($_post[' name ') #11 update table_name set ip=11.11.11. one where qq=1234567; I know this, I do not know the line of QQ how to get, because it is random, not fixed QQ that you this database table inside what is fixed? And which field are you going to change? Change is the attribute that field Ah, QQ number is other conditions filtered out, because the QQ number is the only primary key, so you can get the QQ number is the row, and then the form input attribute content, update data table QQ number is there other table? Did you find this watch or have it been saved? This is the other operation after the check out, but also to make changes to the line
I put out the code and asked God to help change it.

"INSERT into ' newdata ' (' attribute ') VALUES (' $_post[s] ') where????? "
Change data with update, why insert

"INSERT into ' newdata ' (' attribute ') VALUES (' $_post[s] ') where????? "
Change data with update, why insert




Changed, now is Update ' NewData ' Set ' property ' = ' $_post[s] '

After changing, you need to change a place, is the Form Table table label you did not write, but directly write the TR and TD, just didn't add table tag, I use JS and jquery did not get to QQ number, so you have to use Table label to cover TR and TD, and then get QQ number, QQ number can be obtained by JS or introduced jquery.
If it is JS, then

var qq = document.getElementById (' t1 '); var qq_num = Qq.innerhtml;//alert (qq_num);

If it's jquery (don't forget to introduce jquery), then
var qq_num = $ (' td:eq (0) '). html ();




Add an ID to this TD tag to document.getElementById (' T1 ')

  • Related Article

    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.