SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Member
    Join Date
    Oct 2008
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    php update MYSQL problem

    so i have a php page update that adds 1 to the tally like this

    mysql_query("update table set entry1 = entry1 + '1' where user = '$user'");

    The problem is it is being used SO quickly so often that it seems it is missing alot of updates. What would be a better way of doing this that guarantees each update is counted?

  2. #2
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,496
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    It isn't the answer to your question, but I'd eliminate the single quotes around '1'

    Can you explain the situation a bit more? Why is this query executed so often? And why do you think a lot of updates are lost?

  3. #3
    Non-Member
    Join Date
    Oct 2009
    Posts
    1,852
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Database doesn't miss any update sent.
    How do you know there are missing updates?

  4. #4
    SitePoint Member
    Join Date
    Oct 2008
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i am using it to manage users but it is being sent to a separate place that itself includes a count, and it is higher

  5. #5
    SitePoint Member
    Join Date
    Oct 2008
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    also this is being updated upto 500 times a second is that enough for it to possibly miss an update or possibly grab the old entry1 before the new 1 is added in

  6. #6
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,496
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by matt121400 View Post
    also this is being updated upto 500 times a second is that enough for it to possibly miss an update or possibly grab the old entry1 before the new 1 is added in
    Grab the old entry1, no.
    Maybe the request might time out, if too many requests are in the queue. But that should give you an error, I think ?


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
  •