0

Code:

function getUserId($userName) {

    $myModel = new MY_Model();
    $requiredFields = "id";
    $whereClause = [  // line number 35
        "is_active" => 'ACTIVE',
        "user_name" => $userName
    ];
    $userId = $myModel->select("users", $requiredFields, $whereClause);
    return $userId;
}

Error:

Parse error: syntax error, unexpected '[' in /home/com/public_html/_apis/application/helpers/custom_helper.php on line 35
A PHP Error was encountered

Severity: Parsing Error

Message: syntax error, unexpected '['

Filename: helpers/custom_helper.php

Line Number: 35

Backtrace:

2 Answers 2

1

Replace Where Clause with this (Hope this help) :

  $whereClause = array(  // line number 35
       "is_active" => 'ACTIVE',
       "user_name" => $userName
  );
Sign up to request clarification or add additional context in comments.

2 Comments

What is the reason and why it's working on local but not on live plus i have written all the code and i don't want to change it everywhere. On live server the php version is same as the local.
so what is output of your query and tell me ur php version
0

Try this

$whereClause = array();
$whereClause['is_active'] = 'ACTIVE';
$whereClause['user_name'] = $userName;

Comments

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.