<?php
class Person {
private $username ;
private $password;
private $email;
private $geburtsdatum = array "day","month","year";
private $location;
private $job;
private $skype;
function __construct($username , $password , $email, $geburtsdatum, $location, $job, $skype ) {
$this->username = $username ;
$this->password = $password;
$this->email = $email;
$this->geburtsdatum = $geburtsdatum;
$this->location = $location;
$this->job = $job;
$this->skype = $skype;
}
//SET ANFANG
function setUsername ($username ){
$this->username = $username ;
}
public function setPassword($password){
$this->password = $password;
}
function setEmail ($email ){
$this->email = $email ;
}
function setGeburtsdatum ($geburtsdatum ){
$this->geburtsdatum = $geburtsdatum ;
}
function setLocation ($location ){
$this->location = $location ;
}
function setJob ($job ){
$this->job = $job ;
}
function setSkype ($skype ){
$this->skype = $skype ;
}
// GET ANFANG
public function getUsername (){
return $this->username ;
}
public function getPassword(){
return $this->password;
}
public function getEmail(){
return $this->email;
}
public function getGeburtsdatum(){
return $this->geburtsdatum;
}
public function getLocation(){
return $this->location;
}
public function getJob(){
return $this->job;
}
public function getSkype(){
return $this->skype;
}
}
?>
[/php]
Das ist php code die von html formular die felder ausliest. Es gehen alle felder bis auf geburtdadtum nur ich verstehe nicht wo das fehler ist. Ich zeige euch auch MySQL Befehl:
[php]
<?php
include_once 'ClassPerson.php';
$person = new Person($_POST['username'], $_POST['password'], $_POST['email'], $_POST['geburtsdatum'], $_POST['location'], $_POST['job'], $_POST['skype']);
$mysql = new MySQLi('localhost', 'root', '', 'loginsystem');
if(!$mysql){
echo 'Nicht Verbunden';
}
else{
echo 'Datenbankverbindung hergestellt';
echo '<br>';
}
/* EMAIL CHEKING ANFANG */
if ( $_POST['email'] == $_POST['emailconfirm'] )
{
}
else
{
die("E-Mailadressen stehen nicht über ein");
}
/* EMAIL CHEKING ENDE */
$sql = sprintf('INSERT INTO benutzerdaten (username, password, email, geburtsdatum, location, job, skype) VALUES (\'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\' )',
$mysql->real_escape_string($person->getUsername()),
$mysql->real_escape_string($person->getPassword()),
$mysql->real_escape_string($person->getEmail()),
$mysql->real_escape_string($person->getGeburtsdatum()),
$mysql->real_escape_string($person->getLocation()),
$mysql->real_escape_string($person->getJob()),
$mysql->real_escape_string($person->getSkype())
);
$mysql->query($sql);
if($mysql->close()){
echo 'Verbindung getrennt';
echo '<br>';
}
?>