Navigation

    APPDRAG Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular

    REMINDER

    Please be respectful of all AppDragers! Keep it really civil so that we can make the AppDrag community of builders as embracing, positive and inspiring as possible.

    [TM] LAST_INSERT_ID not working

    Cloud Backend (Cloud DB, API Builder)
    2
    2
    203
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Pierre SULPICE
      Pierre SULPICE last edited by

      Hello,

      It seems like this always returns 0 :
      https://dev.mysql.com/doc/refman/8.0/en/information-functions.html#function_last-insert-id

      For the following reason probably (quote from Stackoverflow)
      The problem seemed to be in MySQL's phpmyadmin config file PersistentConnections set to FALSE which resulted in a new CONNECTION_ID every time a query was issued - therefore rendering SELECT LAST_INSERT_ID() ineffective.

      Is there a way tog et the ID of the last inserted row ?
      I'm doing a "full" select after my insert now, it's not ideal 😕

      Thanks,
      Best regarsd,

      1 Reply Last reply Reply Quote 0
      • Joseph Benguira
        Joseph Benguira last edited by

        Hey Pierre,

        This must be done in the same transaction, please check this tutorial about it:
        https://support.appdrag.com/blog/63-Inserting-a-Row-in-the-Database--Create-New-Row-Id.html?category=13

        1 Reply Last reply Reply Quote 0
        • First post
          Last post