CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 Question about retrieving a new autoincrement id

Print topic Send  topic

Author Message
Donna
Posted: 06/17/2002, 6:41 AM

Hi!

I am trying to apply the example listed in tips entitled "Retrieving the value of an autoincrement field after inserting a record". My second form still appears with a blank record. Can anyone tell me what's wrong with my code or page params? I'm using php and mysql.

My table is "Videos". My first page is "AddNewMovie.php" (this is the form that creates the new record). My second page, that I'm trying to pass the newly created id to is "UploadNewVideo.php".

In AddNewMovie.php, my form action is set to "UploadNewVideo", the form input is "UserID" param and the following text is included in the AfterInsert event EXACTLY as it appears below...

$last = mysql_insert_id ();
//append the value to the sParams variable. This should be done only if the record form has transfer input parameters
//$sParams .= "&Video_ID=".$last;
// If there are no transfer input parameters, append the value to the sActionFileName variable
$sActionFileName .= "?Video_ID=".$last;
//You can also set a session variable to contain the value
//set_session("Video_ID") = $last;

In UploadNewVideo.php the form action is set to "AddNewMovie" and the form inputs are "UserID" and "VideoID" both params.

Thanks for any help you can offer,
Donna
Donna
Posted: 06/17/2002, 7:41 AM

First I added an input param in the form of AddNewMovie.php. It was Video_ID and I checked the transfer option.

Then, I used the following code in the AfterInsert event...

$last = mysql_insert_id ();
//append the value to the sParams variable. This should be done only if the record form has transfer input parameters

$sParams .= $last;

Thanks anyway!

   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.