SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Apr 2013
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Data being displayed multiple times. Can't figure out the problem for the life of me

    When i submit info into my form, it gets displayed multiple times on the page.

    PHP Code:
    while($row mysql_fetch_array($data)) {
     
     Print 
    "<tr>"
     Print 
    "<th>Hit:</th> <td>".$row['hit'] . "</td> "
     Print 
    "<th>Amount:</th> <td>".$row['amount'] . " </td></tr>"
     Print 
    "<th>Category:</th> <td>".$row['category'] . "</td> ";
     } 
     Print 
    "</table>"
    I am very new with all of this and just can't figure out the problem. it didnt start until i added that part in the code. When i refresh, more data gets posted also. I'm just not sure what i'm doing wrong.

  2. #2
    SitePoint Evangelist captainccs's Avatar
    Join Date
    Mar 2004
    Location
    Caracas, Venezuela
    Posts
    516
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    The only thing I see wrong is that the closing </tr> tag is in the wrong place.
    Denny Schlesinger
    web services

  3. #3
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    73 Post(s)
    Tagged
    0 Thread(s)
    Show us your query....
    Never grow up. The instant you do, you lose all ability to imagine great things, for fear of reality crashing in.

  4. #4
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,631
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by l1nl1cker View Post
    When i refresh, more data gets posted also.
    Do you get a prompt about resending data (when you refresh)? If yes that'll be why more data gets posted - your code is processing the form again and inserting the data again, seeing it as a new submission.
    Ian Anderson
    www.siteguru.co.uk

  5. #5
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    73 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by siteguru View Post
    Do you get a prompt about resending data (when you refresh)? If yes that'll be why more data gets posted - your code is processing the form again and inserting the data again, seeing it as a new submission.
    (which may imply you have an issue with uniqueness in your database)
    Never grow up. The instant you do, you lose all ability to imagine great things, for fear of reality crashing in.


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •