0

When I try to put my website in production, i get an error, but everything works well in my wamp localhost.

The error =>

  • Type: ErrorException
  • Code: 8
  • Message: Undefined offset: 0
  • File: *******/httpdocs/alliance/slimrest/datamanager/dm_utilisateur.php
  • Line: 20

Le line 20 is the last of this code portion =>

    $user = $o_utilisateur->getUserByLogPass($log, $pass);

    if(isset($user['0'])){
        //GET group BY user
        $tmp = $o_droit->getGroupById($user['0']['TB_groupe_id_groupe']);
        $user['0']['libele'] = $tmp['0']['libele'];

I might be the PHP version ?

  • Localhost : PHP_VERSION = 5.5.12
  • Server : PHP_VERSION = 5.5.9-1ubuntu4.4
2
  • 1
    Change all occurrences of $user['0'] to $user[0] Commented Oct 13, 2014 at 14:59
  • echo "<pre>"; var_dump($user); exit; Commented Oct 13, 2014 at 15:01

1 Answer 1

2

You checked isset($user['0']), but not isset($tmp['0']). The problem must be with the $tmp variable, it has no 0 key.

if(isset($user['0']) && isset($tmp['0']))

I don't know what $tmp is supposed to contain, but for some reason it doesn't contain it on your production server. You need to check whatever code creates the $tmp array, perhaps it's a database problem, did you upload the DB to production?

Sign up to request clarification or add additional context in comments.

1 Comment

Thanx, you were right, the problem was that the SQL version of my localhost understood my SQL request ( SELECT * FROM TB_rights ) but the SQL version of the server didn't. I had to change my request to : ( SELECT * FROM tb_rights ).

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.