If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Enjoy an ad free experience by logging in. Not a member yet? Register.

Find an id before it's created

This is a very puzzling question. When someone creates a new alliance, the ID is an auto increment. However I need to also add a bank, but need to know how to pull the id that was just created to insert into the next table. Any ideas? Because my idea isn't a good one. Thanks

you cannot execute a PHP function inside a string. besides that, you obviously have to wait for the ID to be inserted before you can fetch it.

The computer is always right. The computer is always right. The computer is always right. Take it from someone who has programmed for over ten years: not once has the computational mechanism of the machine malfunctioned.

The computer is always right. The computer is always right. The computer is always right. Take it from someone who has programmed for over ten years: not once has the computational mechanism of the machine malfunctioned.

Yes, MySQL (and PHP) is SLOPPY enough to allow you to use strings in place of numbers (and so MySQL or PHP will convert them to numbers for you), but IT IS A BAD PRACTICE to use the wrong data type! Try to use the appropriate values for the given fields.

so a new alliance is being made and the auto increment id is working fine. However nothing is being made under alliancebank. Nothing is inserted into the database and there is no errors in the error log.

The computer is always right. The computer is always right. The computer is always right. Take it from someone who has programmed for over ten years: not once has the computational mechanism of the machine malfunctioned.