Ver Mensaje Individual
  #15 (permalink)  
Antiguo 06/07/2013, 09:57
aesu
 
Fecha de Ingreso: noviembre-2011
Ubicación: Zulia/Maracaibo
Mensajes: 24
Antigüedad: 12 años, 5 meses
Puntos: 0
Respuesta: Problema al obtener el ultimo id insertado(AYUDENME POR FAVOR)

bueno en realidad son tres clases...
-AppDataBaseModel
-User
-UserPersonalInfo

Esta es la otra la cual agrega el usuario y después de agregado es que obtengo el último id insertado
Código PHP:
Ver original
  1. <?php
  2.  
  3. class User extends AppDataBaseModel{
  4.     private $userName;
  5.     private $userCountryId;
  6.     private $userLastName;
  7.     private $userIdnumberNationality;
  8.     private $userIdnumber;
  9.     private $userMail;
  10.     private $userLogin;
  11.     private $userPassword;
  12.     private $userRegDate;
  13.     private $userEditedDate;
  14.     private $userLastVisit;
  15.     private $userActivated;
  16.     private $userStatus;
  17.     private $userLevelAccess;
  18.     private $userTerms;
  19.    
  20.     private $tableName = _TABLE_USERS_;
  21.     private $tableName2 = _TABLE_USERS_LEVEL_ACCESS_;
  22.     private $tableName3 = _TABLE_USERS_INFO_;
  23.     private $theId ='u_user_id';
  24.     private $orderBy ='u_user_id';
  25.    
  26.     //DECLARAMOS EL CONSTRUCTOR DE LA CLASE EL CUAL SE LLAMA AL MOMENTO DE INSTANCIAR LA CLASE Y RECIBE LOS DATOS A TRAVES DE SUS PARAMETROS
  27.     public function __construct($userId=0,$userCountryId=0,$userName="",$userLastName="",$userIdnumberNationality="",$userIdnumber="",$userMail="",$userLogin="",$userPassword="",$userRegDate=0,$userEditedDate=0,$userLastVisit=0,$userActivated="",$userStatus="",$userLevelAccess=0,$userTerms=0){
  28.  
  29.    
  30.         $this->userName = $userName;
  31.         $this->userCountryId = $userCountryId;
  32.         $this->userLastName = $userLastName;
  33.         $this->userIdnumberNationality = $userIdnumberNationality;
  34.         $this->userIdnumber = $userIdnumber;
  35.         $this->userMail = $userMail;
  36.         $this->userLogin = $userLogin;
  37.         $this->userPassword = $userPassword;
  38.         $this->userRegDate = $userRegDate;
  39.         $this->userEditedDate = $userRegDate;
  40.         $this->userLastVisit = $userLastVisit;
  41.         $this->userActivated = $userActivated;
  42.         $this->userStatus = $userStatus;
  43.         $this->userLevelAccess = $userLevelAccess;
  44.     }//FIN DEL CONSTRUCTOR
  45.    
  46.     public function save(){
  47.    
  48.         $getResult = $this->executeQuery("INSERT INTO ".$this->tableName."(u_user_id,
  49.                                                u_user_country_id,
  50.                                                u_user_name,
  51.                                                u_user_lastname,
  52.                                                u_user_id_number_nationality,
  53.                                                u_user_id_number,
  54.                                                u_user_mail,
  55.                                                u_user_login,
  56.                                                u_user_password,
  57.                                                u_user_reg_date,
  58.                                                u_user_edited_date,
  59.                                                u_user_last_visit,
  60.                                                u_user_activated,
  61.                                                u_user_status,
  62.                                                u_user_level_access,
  63.                                                u_user_policy)
  64.                                             VALUES  ('',
  65.                                                '".$this->userCountryId."',
  66.                                                '".$this->escapeSqlString($this->userName)."',
  67.                                                '".$this->escapeSqlString($this->userLastName)."',
  68.                                                '".$this->escapeSqlString($this->userIdnumberNationality)."',
  69.                                                '".$this->escapeSqlString($this->userIdnumber)."',
  70.                                                '".$this->escapeSqlString($this->userMail)."',
  71.                                                '".$this->escapeSqlString($this->userLogin)."',
  72.                                                '".$this->escapeSqlString(md5($this->userPassword))."',
  73.                                                NOW(),
  74.                                                NOW(),
  75.                                                '',
  76.                                                '".$this->userActivated."',
  77.                                                '".$this->userStatus."',
  78.                                                '".$this->userLevelAccess."',
  79.                                                '".$this->userTerms."');"); 
  80.                        
  81.         return $getResult;
  82.     }//FIN DEL METODO SAVE
  83.    
  84.  
  85. }//FIN DE LA CLASE
  86.  
  87. ?>