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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T13:56:29+00:00 2026-06-10T13:56:29+00:00

I had a model that had an unrelated class defined inside of it. I

  • 0

I had a model that had an unrelated class defined inside of it.
I was prototyping and didn’t spend time to create it properly.
Now that the prototype was accepted by my end users, I’m revisiting and I would like to reorg my code properly. The class looks something like this:

   <?php

        class myclassABC 
        {

           private $_hostname;
           private $_password;
           private $_username;
           private $_connection;
           private $_data;
           private $_timeout;
           private $_prompt;

           public function __construct($hostname, $password, $username = "", $timeout = 10) 
           {

             $this->_hostname = $hostname;
             $this->_password = $password;
             $this->_username = $username;
             $this->_timeout = $timeout;
            } // __construct


           public function connect() 
           {
           } 

           public function dosomethingelse() 
           {
           } 

        }//end class

I’ve moved all this code into a separate file, and this file is now in my libraries folder. But i’m having problems figuring out how to properly instantiate an object in my model.
I tried:

        //pass all the data we need as an array of parameters.
        $params = array('_hostname' => '$ip', '_password' => 'password', '_username' => '');
        $hp = $this->load->library($classname,$params ); 
        $hp->connect();
        $data= $hp->dosomethingelse();
        $hp->close();

It’s loading the right class, but I’m getting the following error message:

Severity: Warning

Message: Missing argument 2 for HP5406_ssh::__construct(), called in
/var/www/m.racktables/system/core/Loader.php on line 1095 and defined

Filename: libraries/HP5406_ssh.php

Line Number: 22

Argument two is the password.
Sorry, this is my first attempt at using libraries with codeigniter.
if you could provide some suggestions, it’d be appreciated.

  • 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-06-10T13:56:30+00:00Added an answer on June 10, 2026 at 1:56 pm

    The problem is that the constructor was not expecting an array. Which is what I am passing, based on the example in the codeigniter manual under the libraries section. i changed my constructor to accept an array and now it works.
    I’m going to post another question to see how I can pass individual parms.

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

Sidebar

Related Questions

Let's say I had a model that looked something like this: class SomeModel def
We had a View Model that looked like this: public class myViewModel { public
I had an original data model that was used to create NSManagedObject subclasses. I
I have a simple model that is defined as: class Article(models.Model): slug = models.SlugField(max_length=50,
Had a problem with the recursive conflictCheck() method. That seems fine now. I have
imagine that you had a task that finished in, say 10 seconds. Now, after
Supposing you had a data model that looks like: /-----------------------\ /-----------------------\ | Patient |
I had a Linq query against my Entity Framework model that was something like:
I have an object model that looks like this (pseudo code): class Product {
If I had a field in the model that has primary_key=True and a default

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.