Re: Insert and Update on same page

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



You didn't mention which database you're working with, so I'll assume mysql. 
In a word, yes, this is possible, just do it in sequence. 

pseudo-code:

mysql_query("insert blah blah");
$id = mysql_insert_id();
$data = mysql_fetch_assoc(mysql_query("select * from table where id = $id"));
$uniqueID = (put your code here)
mysql_query("update blah blah blah");

// done. 

On Monday 01 November 2004 12:00 pm, Bomgardner, Mark A wrote:
> I've got a problem with trying to insert and updating on the same page.
> Here is my problem:
>
>
>
> I have a form that the user fills out.  Upon submission, I want the
> information that was just inserted, to be pulled back out and shows to
> the user with an unique number for that record other than the record ID
> field.  I can use the ID field together with another value to get the
> unique number that I want, but it would require a insert, select and
> update in one shot.  Is this possible?
>
>
>
> I hope I have not confused everybody
>
>
>
> Mark A. Bomgardner
> Technology Specialist
> KLETC

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux