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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:18:24+00:00 2026-05-27T00:18:24+00:00

EDIT 23/11 : Solution founded … I wrote $_db instead $this->_db in the constructor

  • 0

EDIT 23/11 : Solution founded … I wrote $_db instead $this->_db in the constructor ! WHAT A NOOB !

I try to create a new model in my ZF application.
I get an error :

Fatal error: Call to a member function select() on a non-object in [...]/models/TrackingPageMapper.php on line 86

I’m new user of ZF and I think I forget anything.

Here is my class code :

/**
 * TrackingPageMapper
 * @author Raphaël Deschler - developpeur@la-ligne-web.com
 * @version 0.1
 */

class Default_Model_TrackingPageMapper
{
    private $_db;

/**
 * __construct
 */
public function __construct() 
{
    $_db = Zend_Db_Table::getDefaultAdapter();
}

#-----[Public Section]

/**
 * addView()
 * @param EtId, etablissement id
 * 
 * Check :
 * 1) If this is the first click of the day for this IP on this page
 * 2) If this is the first click of the month for this IP
 * 3) Save or not
 * 
 * @return void
 * 
 */
public function addView($EtId)
{
    $today = getDate();
    $ip = $this->getRealIp();
    
    //Check If is the IP exists
    $this->ipExists($ip, $EtId);
    
    //print_r($today);
    
    
    
    
}

#-----[Private Section]

/**
 * getRealIp()
 * @return varchar(15)
 * 
 */
private function getRealIp()
{
    if (!empty($_SERVER['HTTP_CLIENT_IP']))
    {
      $ip = $_SERVER['HTTP_CLIENT_IP'];
    }
    elseif(!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
    {
      $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
    }
    else
    {
      $ip = $_SERVER['REMOTE_ADDR'];
    }
    
    return $ip;
}

/**
 * ipExists()
 * @param Ip address
 * @param EtId, etablissement id
 * 
 * @return false if ip !exists
 * @return array of ip infos if exists
 * 
 */
public function ipExists($Ip, $EtId = null)
{
    $myQuery = $this->_db->select()
                         ->from('tracking_ip', 'idtracking_ip')
                         ->where('ip = ?',$Ip);
    
    $result = $this->_db->fetchAll($myQuery);
    
    print_r($result);
}
}

And I call this Model like that :

$oTrack = new Default_Model_TrackingPageMapper;
$oTrack->addView($Id);

Anyone can help me ?

Thanks for your support comming,

Edit

var_dump($_db);

object(Zend_Db_Adapter_Pdo_Mysql)#76 (12) {
  ["_pdoType":protected]=>
  string(5) "mysql"
  ["_numericDataTypes":protected]=>
  array(16) {
    [0]=>
    int(0)
    [1]=>
    int(1)
    [2]=>
    int(2)
    ["INT"]=>
    int(0)
    ["INTEGER"]=>
    int(0)
    ["MEDIUMINT"]=>
    int(0)
    ["SMALLINT"]=>
    int(0)
    ["TINYINT"]=>
    int(0)
    ["BIGINT"]=>
    int(1)
    ["SERIAL"]=>
    int(1)
    ["DEC"]=>
    int(2)
    ["DECIMAL"]=>
    int(2)
    ["DOUBLE"]=>
    int(2)
    ["DOUBLE PRECISION"]=>
    int(2)
    ["FIXED"]=>
    int(2)
    ["FLOAT"]=>
    int(2)
  }
  ["_defaultStmtClass":protected]=>
  string(21) "Zend_Db_Statement_Pdo"
  ["_config":protected]=>
  array(7) {
    ["username"]=>
    string(4) "riad"
    ["password"]=>
    string(7) "xxxxxx"
    ["dbname"]=>
    string(8) "riad_dev"
    ["charset"]=>
    string(4) "utf8"
    ["driver_options"]=>
    array(1) {
      [1002]=>
      string(14) "SET NAMES utf8"
    }
    ["persistent"]=>
    bool(false)
    ["options"]=>
    array(3) {
      ["caseFolding"]=>
      int(0)
      ["autoQuoteIdentifiers"]=>
      bool(true)
      ["fetchMode"]=>
      int(2)
    }
  }
  ["_fetchMode":protected]=>
  int(2)
  ["_profiler":protected]=>
  object(Zend_Db_Profiler)#74 (4) {
     ["_queryProfiles":protected]=>
     array(0) {
     }
    ["_enabled":protected]=>
    bool(false)
    ["_filterElapsedSecs":protected]=>
    NULL
    ["_filterTypes":protected]=>
    NULL
  }
  ["_defaultProfilerClass":protected]=>
  string(16) "Zend_Db_Profiler"
  ["_connection":protected]=>
  NULL
  ["_caseFolding":protected]=>
  int(0)
  ["_autoQuoteIdentifiers":protected]=>
  bool(true)
  ["_allowSerialization":protected]=>
  bool(true)
  ["_autoReconnectOnUnserialize":protected]=>
  bool(false)
   }
  • 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-27T00:18:25+00:00Added an answer on May 27, 2026 at 12:18 am

    Solution found … I wrote $_db instead $this->_db in the constructor

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

Sidebar

Related Questions

Intro: EDIT: See solution at the bottom of this question (c++) I have a
EDIT: This was formerly more explicitly titled: - Best solution to stop Kontiki's KHOST.EXE
My current solution will suck sometimes EDIT For those who don't understand,see this example:
Edit: Solution: http://jsfiddle.net/VnXtP/ Why dosent this work? http://jsfiddle.net/uc7kT/ <input type=text name=item_quantity id=item_quantity value=1 />
Edit (Solution Discovered) Thanks everyone for your help on this. The problem was an
[edit] Found the solution. Reinstall EVERYTHING - xcode, mono, monodevelop and monotouch. Now it
Please note the Edit below for a lot more information, and a possible solution
Edit: This question was written in 2008, which was like 3 internet ages ago.
EDIT Solution: Visit your IP in the browser after you node server.js to kick-start
Edit: solution added. Hi, I currently have some working albeit slow code. It merges

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.