Vikram Anand Bhushan
Vikram Anand Bhushan

Reputation: 4886

member function when called result into Fatal error Call to undefined function in php

I have a class

<?php
include 'mysql.php';
include '/XXXXXXXXXXX/web/settings/funciones.php';

class processXML
{
var $idFeed;
var $idPais;
var $suf,$pref;
var $lastCode;
var $curCode;
var $localDb ;
var $remoteDb ;
var $imagenTag; 
var $palntilla;

  function processXML($x, $y)
  {
      $his->idFeed = $x;
      $this->idPais=$y;
      $this->localDb = new dataBase();


  }

 function setLC()
 {
     $sql = "SELECT max(id) as ID,feed , idpropiedad FROM `registrofeed` WHERE feed=".$his->idFeed."";
     $result = $this->localDb->execute($sql);
     $row=mysql_fetch_array($result);
     $this->lastCode = $row['idpropiedad'];
 }

 function setImageTag()
 {
     $this->palntilla = returnPlantilla($his->idFeed); 

    $result = $this->localDb->execute("select infopropiedades from propiedadesPlantilla where palntilla=".$this->palntilla."");

    $row=mysql_fetch_array($result);
    $propiedadesColumn = explode("[;;]",$row["infopropiedades"]);

    foreach($propiedadesColumn as $val)
    {
       $x= explode("=",$val);   
       if(trim($x[0])=="Fotos" or trim($x[0])=="fotos")
       {
         $this->imagenTag = trim($x[1]);   
       }

    }

 }

 function printVars()
 {
     setLC();
     setImageTag();

     echo "idFeed=".$this->idFeed."<br>";
     echo "idPais=".$this->idPais."<br>";
     echo "imgTag=".$this->imagenTag."<br>";
     echo "lastCode=".$this->lastCode."<br>";    
 }



}

Then I am calling the class like this

$obj = new processXML(20,4);
$obj->printVars();

I am getting a fatal error

Fatal error: Call to undefined function setLC() in 

Any idea why

Thanks in advance

Upvotes: 0

Views: 35

Answers (2)

Priyank
Priyank

Reputation: 3868

$this->setLC();
$this->setImageTag();

also fix this:

$this->idFeed = $x; instead of $his->idFeed = $x; // in processXML function

Upvotes: 1

jeroen
jeroen

Reputation: 91734

You are calling a class method, so you need:

$this->setLC();
$this->setImageTag();

// etc.

Upvotes: 1

Related Questions