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 839407
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T05:27:30+00:00 2026-05-15T05:27:30+00:00

Hi I have a class called User and a method called insertUser(). function insertUser($first_name,

  • 0

Hi I have a class called User and a method called insertUser().

function insertUser($first_name, $last_name, $user_name, $password, $email_address, $group_house_id)
  {
    $first_name = mysql_real_escape_string($first_name);
    $last_name = mysql_real_escape_string($last_name);
    $user_name = mysql_real_escape_string($user_name);
    $password = mysql_real_escape_string($password);
    $email_address = mysql_real_escape_string($email_address);

    $query = "INSERT INTO Users
              (FirstName,LastName,UserName,Password,EmailAddress, GroupHouseID) VALUES
              ('$first_name','$last_name','$user_name','$password','$email_address','$group_house_id')";
    $mysql_query($query);
  }

And I call it like this:

$newUser = new User();
$newUser->insertUser($first_name, $last_name, $user_name, $email, $password,          $group_house_id);

When I run the code I get this error:

Fatal error: Function name must be a string in /Library/WebServer/Documents/ORIOnline/includes/class_lib.php on line 33

Anyone know what I am doing wronly? Also, this is my first attempt at OO PHP.

Cheers,

Jonesy

  • 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-15T05:27:31+00:00Added an answer on May 15, 2026 at 5:27 am

    $mysql_query($query); => mysql_query($query);. Note the missing dollar. If you try to use function call syntax on a variable, it looks for a function with the name given by the value of the variable. In this case, you don’t have a mysql_query variable, so it comes back with nothing, which isn’t a string, and thus gives you the error.

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

Sidebar

Related Questions

I have a class called UserInfo that contains details about a given user. There
I have a function in a class file called auth_user and its in App_code
I have a class User with one field called birthDate which is a java.sql.Date
I have a table called Users ( class User < ActiveRecord::Base ) and a
I have a model called Person. I want User to inherit from Person. class
I'm working on a forum software currently. I have a class called User, within
I have a method called getTheUserInput in a class which returns a String which
I am learning user controls in C# so basically I have a class called
I have a generic class called Repository. This class has a function that calls
I have a class called Story that is associated with a class called User

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.