class register { public $username = null; public $usernameOn = null; public function validUsername($username) { $this->usernameOn = 1; if($username !== $valdiation){ $shEr[1] = 1; return false; } if($characters > 12 or $characters < 4){ $shEr[2] = 1; return false; } return true; } public function addToBase() { if($this->usernameOn and $this->validUsername($this->username)){ } } }
I wszystko by mi odpowiadało i śmigało jak należy , gdyby nie zakończenie.
W ten sam sposób co username sprawdzam hasło emaila etc. i gdy wszystkie dane w formularzu są wymagane to nie ma problemu bo w $sql daje wszystko na sztywno.
Problem pojawia się kiedy nie wszystkie funkcje mają być użyte np. imie etc.
Nie mam pomysłu jak zrobić aby w zapytaniu sql pojawiało się to co mam użyte np. ($this->imieOn $this->nazwiskoOn)
Wpadłem tylko na pomysł, żeby po zapytaniu przesyłającym dane wymagane przesyłać pojedyńczo dane niewymagane (WHERE)
Ale, może jest lepszy sposób ?