1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

MySQL UPDATE problem

Discussion in 'PHP' started by profs77, Dec 12, 2005.

  1. #1
    I'm trying to trouble shoot a friends script on his site. He's got two domains and the same script on both sites, he says the script works on one site but it doesn't update certain data to the database like the other site does. The one that has trouble updating has MySQL version 3.23.58 and the site that works fine has MySQL version 4.1.13 . What are the main programming differences between these two versions that would cause the database not to update. The code is hard to understand because its pages long and I didn't write it.
    SEMrush
     
    profs77, Dec 12, 2005 IP
    SEMrush
  2. HN Will

    HN Will Guest

    Messages:
    111
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Yeah, I hear you on the confusing code. Even if you never think anyone else is going to see your code - it might be you three months from now and you'll have no idea what you did. Thus, one should code such that a kid could understand what was going on.

    Anyway, the UPDATE call has been around since the beginning, so I don't think its that - unless there's some crazy parameter that is new.....what's the code like?
     
    HN Will, Dec 13, 2005 IP
    profs77 likes this.
  3. profs77

    profs77 Well-Known Member

    Messages:
    441
    Likes Received:
    39
    Best Answers:
    0
    Trophy Points:
    118
    #3
    Well the SQL text is like UPDATE this FROM that WHERE this occurs, there isn't any kind of backquotes or single quotes used (` or '), so thats where there may be a problem. The code looks like a big mess, every programmer needs to use comments.
     
    profs77, Dec 13, 2005 IP
  4. profs77

    profs77 Well-Known Member

    Messages:
    441
    Likes Received:
    39
    Best Answers:
    0
    Trophy Points:
    118
    #4
    I'm trying to trouble shoot a friends script on his site. He's got two domains and the same script on both sites, he says the script works on one site but it doesn't update certain data to the database like the other site does. The one that has trouble updating has MySQL version 3.23.58 and the site that works fine has MySQL version 4.1.13 . What are the main programming differences between these two versions that would cause the database not to update. The code is hard to understand because its pages long and I didn't write it.
     
    profs77, Dec 13, 2005 IP
  5. dct

    dct Finder of cool gadgets

    Messages:
    3,134
    Likes Received:
    328
    Best Answers:
    0
    Trophy Points:
    230
    #5
    If memory serves a big difference is sub queries never worked in the earlier version. Do you get any type of error return?
     
    dct, Dec 13, 2005 IP
  6. profs77

    profs77 Well-Known Member

    Messages:
    441
    Likes Received:
    39
    Best Answers:
    0
    Trophy Points:
    118
    #6
    No errors, it just doesn't put the new data into the database.
     
    profs77, Dec 13, 2005 IP
  7. dct

    dct Finder of cool gadgets

    Messages:
    3,134
    Likes Received:
    328
    Best Answers:
    0
    Trophy Points:
    230
    #7
    Need to see the SQL really, can you post a snippet that demonstrates the error
     
    dct, Dec 13, 2005 IP
  8. execute

    execute Peon

    Messages:
    301
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #8
    UPDATE table SET v='1', x='2', z='3' WHERE f='3' AND w='4' AND q='5'

    Make sure the syntax is correct. I use to think you needed SET AND AND AND, but its actually SET , , , .
     
    execute, Dec 13, 2005 IP
  9. profs77

    profs77 Well-Known Member

    Messages:
    441
    Likes Received:
    39
    Best Answers:
    0
    Trophy Points:
    118
    #9
    I would hate to have to find the text in the code that I didn't write, its pages long. Besides MySQL doesn't return an error. It just doesn't update the data into the database. Doesn't make sense, what are the differences between the MySQL versions I mentioned above?
     
    profs77, Dec 13, 2005 IP
  10. PinoyIto

    PinoyIto Notable Member

    Messages:
    5,863
    Likes Received:
    170
    Best Answers:
    0
    Trophy Points:
    260
    #10
    this some times cause also by the php versio you are using or the configuration of your server.

    may be cause by variables... sometimes this is the case...

    if the action script don't use the $_POST[] or $_GET[] try to use it....

    for example:

    UPDATE mytable SET username = $_POST[username] WHERE username = $_POST[username]

    instead of

    UPDATE mytable SET username = $username WHERE username = $username
     
    PinoyIto, Dec 13, 2005 IP
  11. profs77

    profs77 Well-Known Member

    Messages:
    441
    Likes Received:
    39
    Best Answers:
    0
    Trophy Points:
    118
    #11
    I don't think that has anything to do with it because the data is created dynamically from a calculation from another number which updates fine to another table on the database. Also the php version is like .01 off its almost identical.

    What are the differences in the two MySQL versions I mentioned above?
     
    profs77, Dec 13, 2005 IP
  12. PinoyIto

    PinoyIto Notable Member

    Messages:
    5,863
    Likes Received:
    170
    Best Answers:
    0
    Trophy Points:
    260
    #12
    well if you could give as an snipet of the code maybe we can help you to solve the problem. It's hard to guess what really the problem is.
     
    PinoyIto, Dec 13, 2005 IP
  13. cornelius

    cornelius Peon

    Messages:
    206
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #13
    can u just post the code, we cant help u if u dont show us whts wrong
     
    cornelius, Dec 14, 2005 IP
  14. execute

    execute Peon

    Messages:
    301
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #14
    please do not tell a problem without a code. Because we can't help you this way. Or you should think about it by just staring at a code like me, and it'll come to you.
     
    execute, Dec 14, 2005 IP
  15. vectorgraphx

    vectorgraphx Guest

    Messages:
    545
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    0
    #15
    might help if you were to post some example error codes generated on the site pointing to the 3.23.58 build... otherwise you could look at the build history on the mysql site, there are too many differences to list easily. better to look at the symptom first.

    VG
     
    vectorgraphx, Dec 14, 2005 IP
  16. profs77

    profs77 Well-Known Member

    Messages:
    441
    Likes Received:
    39
    Best Answers:
    0
    Trophy Points:
    118
    #16
    There aren't any error codes, just doesn't update the information to the database. Also I tried looking for that site your talking about that would list the differences between the two MySQL versions, I couldn't find it.
     
    profs77, Dec 14, 2005 IP
  17. l234244

    l234244 Peon

    Messages:
    1,225
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    0
    #17
    Why not post the database structure and the sql code which is supposed to update the database
     
    l234244, Dec 14, 2005 IP
  18. vectorgraphx

    vectorgraphx Guest

    Messages:
    545
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    0
    #18
    vectorgraphx, Dec 14, 2005 IP
  19. profs77

    profs77 Well-Known Member

    Messages:
    441
    Likes Received:
    39
    Best Answers:
    0
    Trophy Points:
    118
    #19
    Its not my script so don't critisize it. Its supposed to take the Account Credits and calculate the earnings and update them to the database, but it doesn't do that. The script is attached.:confused:
     

    Attached Files:

    profs77, Dec 14, 2005 IP
  20. profs77

    profs77 Well-Known Member

    Messages:
    441
    Likes Received:
    39
    Best Answers:
    0
    Trophy Points:
    118
    #20
    Thanks for the site VectorGraphX, what does this mean? Anyone?

    Fixed security problem where mysqld didn't allow one to UPDATE rows in a table even if one had a global UPDATE privilege and a database SELECT privilege.
     
    profs77, Dec 14, 2005 IP