I created a user model in Code Igniter.
class User extends CI_Model {
function __construct() {
parent::__construct();
}
public function new($username, $email, $password, $studentID="") {
$this->db->query("INSERT INTO user VALUES (0, '$username', '$email', '$password', '$studentID')");
}
}
However, I am getting this PHP error.
Parse error: syntax error, unexpected T_NEW, expecting T_STRING in /home/davidfaux/testApp/application/models/user.php on line 12
Line 12, by the way, is this line.
public function new($username, $email, $password, $studentID="") {
What is a T_NEW? Why am I getting the error?
newis a reserved word for creating new objects, likenew Person('Joe').You should rename your function.
See http://php.net/manual/en/reserved.keywords.php for reference.