0

I need to get the sso (employee number) number from the logged user in order to complete a query, but it tells me that there is an error in line 12, I can't figure out the problem can somebody help me?

include_once('../../include/config.inc.php');

session_start();
if($_SESSION['utype']=='Manager'){
    //Se buscan todos los datos de los empleados q pertenecen a el área lidereada por el usuario
    //Se extrae el id del jefe
    $query='select HIGH_PRIORITY userId from mgit_users.users where hrOracleNumber='.$_SESSION['sso'];
    $exec=$conn->execute ($query) or die ("Error $query".$conn->errorMsg());        
    $chiefId=$exec->fields['userId'];   
    $exec->Close();
    }
//Despliega la tabla principal
function cargar(){
    $respuesta = new xajaxResponse('ISO-8859-1');
    include('../connection/connection.php');
    //Se extrae la información de todos los records existentes
$query="SELECT HIGH_PRIORITY cc.name ccname, cc.description ccdesc, CONCAT(u.firstName,' ',u.lastName) ccowner, cc.ownerSSO osso, cc.initialBudget abudget, cc.actualBudget cbudget, cc.plannedBudget pbudget  
        FROM hr_cost_centers cc, mgit_users.users u
        WHERE cc.ownerSSO = hrOracleNumber
    ORDER BY ccname";
10
  • which line is line 12, and what is the error it gives you. Commented Jan 12, 2013 at 0:31
  • You are missing the closing tag of your function? } Commented Jan 12, 2013 at 0:31
  • is this: $exec=$conn->execute ($query) or die ("Error $query".$conn->errorMsg()); and it says this: Fatal error: Call to a member function on a non-object in /usr/local/apache/htdocs/areas/psae/psae_tools/TrainingNeedsAssesment/modules/costCentersStatus/index.php on line 12 Commented Jan 12, 2013 at 0:32
  • @cheese - it's assumed he just stopped copy/paste there. he does nothing with the query either. If this is really how his file ends his problems are much greater than whatever's on line 12 Commented Jan 12, 2013 at 0:32
  • This is just a part of the code. Commented Jan 12, 2013 at 0:33

1 Answer 1

1

This...

Fatal error: Call to a member function on a non-object in /usr/local/apache/htdocs/areas/psae/psae_tools/TrainingNeedsAssesment/modules/co‌​stCentersStatus/index.php on line 12

...means that $conn is not an instance of a class at this point. Typically instantiated by calling new on a class:

$conn = new databaseClass;

EDIT

This resource's example shows "Execute" and not "execute" - this may be important. http://phplens.com/lens/adodb/docs-adodb.htm#ex1

so your line should perhaps be:

$exec=$conn->Execute($query) or die ("Error $query".$conn->errorMsg());  
Sign up to request clarification or add additional context in comments.

3 Comments

I think not because this has never happend before but I'm gonna try doing that.
I see examples of both with and without new, so I doubt that's your problem. It could be you need to call Execute and not execute. Case sensitive.
can you print_r($conn) right after your config include? it should say "object" or something similar.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.