How to Insert a Return ID in MySQL

When you process a mySQL result output in your PHP code -- PHP being the overwhelmingly dominant language used in conjunction with mySQL -- you may need to eventually insert a return ID or variable back into your mySQL database. Accomplish this by creating an appropriate query that connects to your database and inserts the return ID into a new record field.

Instructions

    • 1

      Log in to your database server.

    • 2

      Type "su" on the command line, then press "Enter." Type in your root password when prompted, then press "Enter" again to gain administrative rights.

    • 3

      Type the following code into the command line:

      mysql -i "INSERT INTO `tablename` (`returnID`) VALUES ('your_return_id_value')"

      Here, "tablename" is the name of your mySQL table, "returnID" is the name of the column that holds the return ID and "your_return_id_value" is the value you are inserting into the table.

    • 4

      Press "Enter" to execute the query and insert the return ID into the mySQL database.

Related Searches:

Comments

Related Ads

Featured