-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathUser.php
53 lines (33 loc) · 1.2 KB
/
User.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
include 'DBConnect.php';
class User
{
private $database = null;
function __construct()
{
$this->database = new DBConnect();
$this->database->getConnection();
}
public function createUser($userArray, $addressArray)
{
//Maybe add gets here
$query = "INSERT INTO address (`street`, `city`, `state`, `zip`)
VALUES('".$addressArray[0]."','".$addressArray[1]."','".$addressArray[2]."','".$addressArray[3]."')";
$query = "INSERT INTO user (`firstname`, `lastname`, `username`, `password`, `email`, `id_address1`, `id_addess2`)
VALUES('".$userArray[0]."','".$userArray[1]."','".$userArray[2]."','".$userArray[3]."','"
.$userArray[4]."','".mysql_insert_id()."','".$userArray[6]."')";
$this->database->runQuery($query);
return $query;
}
public function addAddress($addressArray){
$query = "INSERT INTO address (`street`, `city`, `state`, `zip`, `id_user`)
VALUES('".$addressArray[0]."','".$addressArray[1]."','".$addressArray[2]."','".$addressArray[3]."')";
$this->database->runQuery($query);
return $query;
}
}
//$user = new User();
//$users = array('test' , 'test' , 'test4' , 'test' , 'test', 'test', 'test');
//print_r($users);
//print($user->createUser($users));
?>