funcion usa tablas:
users
profile_design
mi tabla original:
account_data --> es a la que quisiera que tambien se guarde ahi contiene filas
id - name - password - email
Código PHP:
public function signUp() {
/*
* ----------------------------------------------
* sign up
* 1) Verified username, if is available
* insert into database
* ----------------------------------------------
*/
$verifiedUsername = self :: checkUsername( $_POST['username'] ) ? 1 : 0;
if( $verifiedUsername == 1 ) {
return( 2 );
}
/*
* -----------------------
* Insert User
* -----------------------
*/
$sql = "
INSERT INTO users
VALUES(
null,
?,
?,
'',
'xx',
?,
?,
'".$this->_dateNow."',
'',
'',
'avatar.png',
?,
'0',
'1',
'pending',
'1',
'1',
'1',
'".$_SESSION['lang']."'
);";
$password = sha1( $_POST['password'] );
$stmt = $this->db->prepare( $sql );
$stmt->bindValue( 1, $_POST['username'], PDO::PARAM_STR);
$stmt->bindValue( 2, $_POST['full_name'], PDO::PARAM_STR );
$stmt->bindValue( 3, $password, PDO::PARAM_STR );
$stmt->bindValue( 4, $_POST['email'], PDO::PARAM_STR );
$stmt->bindValue( 5, $_POST['code'], PDO::PARAM_STR );
$stmt = $stmt->execute();
/*
* -----------------------
* User ID inserted
* -----------------------
*/
$idUsr = $this->db->lastInsertId( $stmt );
if ( $stmt == true ) {
//============================================================//
//= * INSERT PROFILE DESIGN * =//
//============================================================//
$profileDesign = $this->db->prepare("
INSERT INTO profile_design
VALUES
(
null,
?,
'0.jpg',
'left',
'fixed',
'#0088E2',
'#000000',
''
)");
$profileDesign->execute( array( $idUsr ) );
return ( 1 );
}
$this->db = null;
}//<-- end Method
PD: ya intente algunas formas copiando el insert con otro nombre, pero quiero entender realmente como lo harían ustedes en este caso.