Re: Is this possible?

From: Date: Fri, 19 Jul 2002 16:31:18 +0000
Subject: Re: Is this possible?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-108539@lists.php.net to get a copy of this message
Depends on the database - if you're using mysql, you would use mysql_insert_id() (http://www.php.net/manual/en/function.mysql-insert-id.php) immediately after the insert operation, then pass that value to the next page to do the query on that record. Other databases have other methods, some have none. This is, of course, assuming that I understood your question - this works for auto-incremented id values rather than ones you generate yourself. If you are generating your own id, you'd just pass it along to the next page when you redirect. ..mike.. On Fri, 2002-07-19 at 09:14, Mike Tuller wrote: > I want to be able to insert a single item into a database table that has > many columns on one page, and then when submitted, be directed to another > page that shows all the fields to add information in. In this case, I am > creating an inventory app where you would add by selecting the type from a > drop down menu. For example, computer, scanner, printer, book, etc. Then be > directed to a page for that specific type of item to be added. I want the > item selected entered into the database, and then on the next page have the > fields that information needs to be entered into displayed. When the first > page enters the type of item I want to add to the database, it will create > the ID number for that item. This is what I want to get, so that I can have > the next page display properly. How do I enter something, and then pull out > the ID of the row that the item was entered into? >

« previous php.general (#108539) next »