I am having a bit of trouble getting this register function to work. Its for a game server so the password has to be md5 and salted with the username. Here is the function part of the Register.
This is using MVC by the way.
Code:
<?php class Register extends MainController{ function __construct(){ debug_backtrace(); parent::__construct(); $this->view->url = $this->config->url; $this->view->ID = get_class($this); $this->view->Title = "Royal JD > Create Account"; $this->view->render('Register'); function Create_Account(){ $username = isset($_POST['username']) ? $_POST['username'] : ''; $email = isset($_POST['email']) ? $_POST['email'] : ''; $password = isset($_POST['password']) ? $_POST['password'] : ''; $username = mysql_real_escape_string(StrToLower(Trim($username))); $password = mysql_real_escape_string(StrToLower(Trim($password))); $this->view->salt = $username; $this->view->salt = $username.$password; $this->view->salt = md5($this->view->salt); $this->view->salt = "0x".$this->view->salt; //Salts the password in md5. $sql = "INSERT INTO users WHERE name = :name AND passwd = :passwd AND idnumber = :idnumber AND email = :email"; $arr = array(":name" => $username, ":email" => $email, ":idnumber" => $password, ":passwd" => $this->view->salt); $ctr = $this->database->DBQry($sql,$arr); } } } ?>
the database.php looks like this:

Code:
<?php class Database extends PDO{ // Initialize const DBHOST = "localhost"; const DBNAME = "test"; const DBUSER = "root"; const DBPASS = "123"; const SELECT = "SELECT * FROM "; const INSERT = "INSERT INTO "; const UPDATE = "UPDATE "; const DELETE = "DELETE FROM "; // Make Connection function __construct(){ parent::__construct("mysql:host=".self::DBHOST.";dbname=".self::DBNAME,self::DBUSER,self::DBPASS); } // Query function DBQry($sql,$arr){ $sth = $this->prepare($sql, array(PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY)); $sth->execute($arr); $rs = $sth->fetchAll(); return $rs; } // Count function DBCtr($sql,$arr){ $sth = self::prepare($sql, array(PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY)); $sth->execute($arr); return $sth->rowCount(); } // Last ID function DBLst($table){ $sql = $this->SELECT.$table." ORDER BY id DESC LIMIT 1"; $arr = array(); $ctr = self::DBCtr($sql,$arr); $rs = self::DBQry($sql,$arr); return ($ctr > 0) ? $rs[0]['id'] : 0; } // Insert function DBIns($arr,$tbl){ $fld = implode(",",array_keys($arr)); $sql = self::INSERT.$tbl." (".str_replace(":","",$fld).") VALUES(".$fld.")"; $sth = $this->prepare($sql, array(PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY)); $sth->execute($arr); } // Update function DBSet($arr,$tbl,$whr = ''){ $stmt = array(); foreach($arr as $fld => $val){ $stmt[] = str_replace(":","",$fld)." = ".$fld; } $stm = implode(",",$stmt); $sql = self::UPDATE.$tbl." SET ".$stm.' '.$whr; $sth = $this->prepare($sql, array(PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY)); $sth->execute($arr); } // Delete function DBDel($tbl,$whr = ''){ $sql = self::DELETE.$tbl." ".$whr; $this->exec($sql); } } ?>
My issue is that its not sending any info to the database.

Any help will be appreciated!