SitePoint Sponsor

User Tag List

Page 2 of 2 FirstFirst 12
Results 26 to 35 of 35
  1. #26
    SitePoint Guru
    Join Date
    Sep 2004
    Location
    Provo, UT
    Posts
    844
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Jeff, you ran my code and had to fix several errors? How did you do this since the code I supplied requires the use of a mySQL database with the same tables that I use?

    Wolfe, at the very top of the code, $longDate is defined as $longDate = date("Y-m-d H:i:s"); Maybe this is a multiple http request issue, because the duplicate rows are storing slightly different dates. What causes multiple http requests and how do I get rid of them?

    Thanks!
    Convert your dollars into silver coins. www.convert2silver.com

  2. #27
    SitePoint Zealot
    Join Date
    Jul 2012
    Location
    Scarborough, North Yorkshire, United Kingdom
    Posts
    100
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by busboy View Post
    Jeff, you ran my code and had to fix several errors? How did you do this since the code I supplied requires the use of a mySQL database with the same tables that I use?

    Wolfe, at the very top of the code, $longDate is defined as $longDate = date("Y-m-d H:i:s"); Maybe this is a multiple http request issue, because the duplicate rows are storing slightly different dates. What causes multiple http requests and how do I get rid of them?

    Thanks!
    Hi

    How are you submitting the form? You don't have any pesky JavaScript do you that could be causing the double submit?
    Richard
    Resell SSL Certificates - API / WHMCS / HostBill / ClientExec
    ServerTastic - RapidSSL, Geotrust, Thawte, Symantec, SmarterTools and more

  3. #28
    Always A Novice bronze trophy
    K. Wolfe's Avatar
    Join Date
    Nov 2003
    Location
    Columbus, OH
    Posts
    2,079
    Mentioned
    53 Post(s)
    Tagged
    0 Thread(s)
    Whats the setup on these testimonials? Should they be able to submit more than one?

  4. #29
    SitePoint Wizard bronze trophy Jeff Mott's Avatar
    Join Date
    Jul 2009
    Posts
    1,148
    Mentioned
    14 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by busboy View Post
    Jeff, you ran my code and had to fix several errors? How did you do this since the code I supplied requires the use of a mySQL database with the same tables that I use?
    I logged the SQL that would have been executed, rather than actually executing it.
    "First make it work. Then make it better."

  5. #30
    SitePoint Guru
    Join Date
    Sep 2004
    Location
    Provo, UT
    Posts
    844
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Richard, there is no javascript used in this code.

    Wolfe, users can submit as many testimonials as they want, they just need to be unique. Remember, the testimonies table is not having problems with duplicates, it just seems to be the notifications table.

    Someone earlier mentioned that this problem might be caused by multiple http requests. So, my latest idea is to create a new column in the notifications table that would store a randomly generated 4 digit code. Then I could create a unique index that includes the uID, type, and generatedCode columns. I thought I was covered by using the date column, but since the duplicate inserts are sometimes several seconds apart, the unique constraint fails to do its job.

    I know this is kind of a hack, but does anyone have a better idea?

    Thanks!
    Convert your dollars into silver coins. www.convert2silver.com

  6. #31
    SitePoint Guru
    Join Date
    Sep 2004
    Location
    Provo, UT
    Posts
    844
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Still looking for a little help on this, if possible.

    Thanks!
    Convert your dollars into silver coins. www.convert2silver.com

  7. #32
    Always A Novice bronze trophy
    K. Wolfe's Avatar
    Join Date
    Nov 2003
    Location
    Columbus, OH
    Posts
    2,079
    Mentioned
    53 Post(s)
    Tagged
    0 Thread(s)
    You should have two tables from what I'm reading, 1 table for your testimonials, the other for email subscriptions, the emails subscription table should have a primary key of email, to prevent more than one email from entering the table, thus stopping duplicate emails from going out, no matter how many testimonials they write.

  8. #33
    SitePoint Guru
    Join Date
    Sep 2004
    Location
    Provo, UT
    Posts
    844
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Yes, but what about the multiple http requests? What is causing this to happen?
    Convert your dollars into silver coins. www.convert2silver.com

  9. #34
    Always A Novice bronze trophy
    K. Wolfe's Avatar
    Join Date
    Nov 2003
    Location
    Columbus, OH
    Posts
    2,079
    Mentioned
    53 Post(s)
    Tagged
    0 Thread(s)
    Your not going to be able to stop a user from submitting a form multiple time, the data IS GOING to hit your script, its up to you to stop bad data from coming in to your db.

    For each testimonial they want to START, create a unique ID for that session. This will be your primary key on the testimonial table. Create a new session each time they want to start a new testimonial.

  10. #35
    SitePoint Guru
    Join Date
    Sep 2004
    Location
    Provo, UT
    Posts
    844
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I got it figured out now. Thanks for your help everyone!!
    Convert your dollars into silver coins. www.convert2silver.com


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
  •