Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7593377
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T21:09:14+00:00 2026-05-30T21:09:14+00:00

I created a user model in Code Igniter. class User extends CI_Model { function

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T21:09:16+00:00Added an answer on May 30, 2026 at 9:09 pm

    new is a reserved word for creating new objects, like new Person('Joe').
    You should rename your function.

    See http://php.net/manual/en/reserved.keywords.php for reference.

    These words have special meaning in PHP. Some of them represent things
    which look like functions, some look like constants, and so on–but
    they’re not, really: they are language constructs. You cannot use any
    of the following words as constants, class names, function or method
    names. Using them as variable names is generally OK, but could lead to
    confusion.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i created a model object in PHP class User { public $title; public function
I'm trying to test that a UserProfile model is created as a new User
I am new in Rails and web development... I have created a User model,
I am using a code-first methodology. I have created my own user model and
/mysite/project4 class notes(models.Model): created_by = models.ForeignKey(User) detail = models.ForeignKey(Details) Details and User are in
I'd like to do something like this: class Task(models.Model): ... created_by = models.ForeignKey( User,
I have the following validation code processed for my User Model. It works good
I have a users_manager engine which has a User model class. In an other
I have a User Model(:name, :password, :email), and Event model(:name, :etc) and Interest model
I have a user model class User < ActiveRecord::Base has_many :messages_received, :class_name=>Message, :foreign_key=>'receiving_id', :conditions

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.