CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> Español

 hacer insert -tomar select max(id) -poner el id en url

Print topic Send  topic

Author Message
mveraa

Posts: 49
Posted: 08/28/2007, 3:03 PM

hola maestros necesito hacer que cuando hago un insert , tomar el id del ultimo registro
luego pasarlo a la url , lo intento asi.

global $Filename;
$db1=new clsDBConnection1();
$sql1="SELECT max(id_beneficiario) as id_beneficiario FROM beneficiarios where user_reg='".CCGetSession("UserID")."'";
$db1->query($sql1);
$Result1=$db1->next_record();

if ($Result1)
{
$Filename="datos_personales.php";
$id_beneficiario=$db1->f('id_beneficiario');

header("Location:".$Filename."?".CCAddParam(CCGETQueryString("QueryString",""), "id",$id_beneficiario));

}
$db1->close();

lo puse en beneficiarios_Button_Insert_OnClick

pero no me funciona.

alguna idea?
gracias.
View profile  Send private message
Hidran
Posted: 09/01/2007, 2:37 AM

Ponlo en el evento Afterinsert
e añade un die(); después de header
en modo que no continùe la ejecuciòn del programa.
Hidran
"mveraa" <mveraa@forum.codecharge> ha scritto nel messaggio
news:3046d49bc647197@news.codecharge.com...
> hola maestros necesito hacer que cuando hago un insert , tomar el id del
> ultimo
> registro
> luego pasarlo a la url , lo intento asi.
>
> global $Filename;
> $db1=new clsDBConnection1();
> $sql1="SELECT max(id_beneficiario) as id_beneficiario FROM
> beneficiarios
> where user_reg='".CCGetSession("UserID")."'";
> $db1->query($sql1);
> $Result1=$db1->next_record();
>
> if ($Result1)
> {
> $Filename="datos_personales.php";
> $id_beneficiario=$db1->f('id_beneficiario');
>
>
> header("Location:".$Filename."?".CCAddParam(CCGETQueryString("QueryString",""),
> "id",$id_beneficiario));
>
> }
> $db1->close();
>
> lo puse en beneficiarios_Button_Insert_OnClick
>
> pero no me funciona.
>
> alguna idea?
> gracias.
>
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.yessoftware.com/
>


Add new topic Subscribe to topic   


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

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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