About the reply function-php Tutorial

Source: Internet
Author: User
Reply function:
$ SQL = "select * from massage where iid = $ iid order by mid desc limit $ offset, $ pagesize"; $ result = $ db-> query ($ SQL ); while ($ row = $ result-> fetch_assoc ())! = False) {echo'

# '. $ Row ["mid"].'
'. $ Row ["author"].'

'. $ Row ["msg"].'

Reply '. $ row ["time"].'

';}


Copy the content read above to textarea:
Script function toCopy () {var midval = document. getElementById ("mid "). innerHTML; var msg = document. getElementById ("msgten "). innerHTML; document. getElementById ("msgcon "). value = "reply" + midval + "" + "[" + msg + "]"; document. getElementById ("msgcon "). focus ();} script


Effect:


The problem is: the text box will always display the last one read by the database, that is, 13th. copy the one to which reply you want to copy it to the box.


Reply to discussion (solution)

Id = "msgten"

Your id is repeated and cannot be used like this.
Modify it to look like this

$ SQL = "select * from massage where iid = $ iid order by mid desc limit $ offset, $ pagesize"; $ result = $ db-> query ($ SQL ); $ I = 0; while ($ row = $ result-> fetch_assoc ())! = False) {echo'

# '. $ Row ["mid"].'
'. $ Row ["author"].'

'. $ Row ["msg"].'

Reply '. $ row ["time"].'

'; $ I ++ ;}


Script function toCopy (c) {var midval = document. getElementById ("mid" + c ). innerHTML; var msg = document. getElementById ("msgten" + c ). innerHTML; document. getElementById ("msgcon "). value = "reply" + midval + "" + "[" + msg + "]"; document. getElementById ("msgcon "). focus ();} script

Id = "msgten"

Your id is repeated and cannot be used like this.
Modify it to look like this

$ SQL = "select * from massage where iid = $ iid order by mid desc limit $ offset, $ pagesize"; $ result = $ db-> query ($ SQL ); $ I = 0; while ($ row = $ result-> fetch_assoc ())! = False) {echo'

# '. $ Row ["mid"].'
'. $ Row ["author"].'

'. $ Row ["msg"].'

Reply '. $ row ["time"].'

'; $ I ++ ;}


Script function toCopy (c) {var midval = document. getElementById ("mid" + c ). innerHTML; var msg = document. getElementById ("msgten" + c ). innerHTML; document. getElementById ("msgcon "). value = "reply" + midval + "" + "[" + msg + "]"; document. getElementById ("msgcon "). focus ();} script




Thank you for solving the problem.

Id = "msgten"

Your id is repeated and cannot be used like this.
Modify it to look like this

$ SQL = "select * from massage where iid = $ iid order by mid desc limit $ offset, $ pagesize"; $ result = $ db-> query ($ SQL ); $ I = 0; while ($ row = $ result-> fetch_assoc ())! = False) {echo'

# '. $ Row ["mid"].'
'. $ Row ["author"].'

'. $ Row ["msg"].'

Reply '. $ row ["time"].'

'; $ I ++ ;}


Script function toCopy (c) {var midval = document. getElementById ("mid" + c ). innerHTML; var msg = document. getElementById ("msgten" + c ). innerHTML; document. getElementById ("msgcon "). value = "reply" + midval + "" + "[" + msg + "]"; document. getElementById ("msgcon "). focus ();} script



Dear God, why can't I copy my new message to the box?

Try another browser

What? After you submit a new message ,?? To box?

Are you new? Incoming? And then? Refresh? Face, then? List again.
If yes ?? The process is ??? . Unless you are not using a post table? And? There is a refresh list.

Are you new? Incoming? And then? Refresh? Face, then? List again.
If yes ?? The process is ??? . Unless you are not using a post table? And? There is a refresh list.



I submitted it using podt. after the submission is successful, the page is refreshed.
   

Try another browser


Okay. I'll try it back.

After submission, what are the refresh items ????

Cannot I leave a new message? Reply?

Then ?? Did you leave a message? It contains special characters.
Script
Function toCopy (c ){
Var midval = document. getElementById ("mid" + c). innerHTML;
Var msg = document. getElementById ("msgten" + c). innerHTML;
// Add one sentence to see if there is any?
Alert (midval + ''+ msg );
Document. getElementById ("msgcon"). value = "reply" + midval + "" + "[" + msg + "]";
Document. getElementById ("msgcon"). focus ();
}
Script

After submission, what are the refresh items ????

Cannot I leave a new message? Reply?

Then ?? Did you leave a message? It contains special characters.
Script
Function toCopy (c ){
Var midval = document. getElementById ("mid" + c). innerHTML;
Var msg = document. getElementById ("msgten" + c). innerHTML;
// Add one sentence to see if there is any?
Alert (midval + ''+ msg );
Document. getElementById ("msgcon"). value = "reply" + midval + "" + "[" + msg + "]";
Document. getElementById ("msgcon"). focus ();
}
Script



I ran it several times and found that only the one output from the database was invalid. click "reply" to bring up a white box.


After submission, what are the refresh items ????

Cannot I leave a new message? Reply?

Then ?? Did you leave a message? It contains special characters.
Script
Function toCopy (c ){
Var midval = document. getElementById ("mid" + c). innerHTML;
Var msg = document. getElementById ("msgten" + c). innerHTML;
// Add one sentence to see if there is any?
Alert (midval + ''+ msg );
Document. getElementById ("msgcon"). value = "reply" + midval + "" + "[" + msg + "]";
Document. getElementById ("msgcon"). focus ();
}
Script



I ran it several times and found that only the one output from the database was invalid. click "reply" to bring up a white box.



Solved. Open the console and find that the last reply id does not have $ I. I assigned $ I an initial value of 1.

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.