Archive for the ‘WTFs’ Category

  • The PHP Approach to Handling Race Conditions

    Date: 2009.03.28 | Category: Movies, Tech Stuff, WTFs | Response: 0

    Well, I know this isn’t thedailywtf, but coming across this WTF, I just had to share it. Apparently, if you want to know the value of the auto_increment field value from your latest MySQL INSERT statement, you have to make sure you ask for it really quickly,

    Note: Because mysql_insert_id() acts on the last performed query, be sure to call mysql_insert_id() immediately after the query that generates the value.”

    Well, I guess that’s one way to avoid a possible race condition… If you’re retarded ;)