Balakrishnan
Balakrishnan

Reputation: 2441

Database error when accessing $_SERVER variable in Codeigniter

I'm using Codeigniter and I'm trying to echo $_SERVER['HTTP_REFERER']. But whenever I tried to access $_SERVER variable I'm getting database error.

A Database Error Occurred

Unable to select the specified database: MY_DB_NAME

Filename: core/Loader.php

Line Number: 346

Is it a Codeigniter restriction or a bug.

Upvotes: 1

Views: 73

Answers (1)

ajtamwojtek
ajtamwojtek

Reputation: 763

So, you can use :

$this->load->library('user_agent');
echo $this->agent->referrer();

Read also: http://ellislab.com/codeigniter/user-guide/libraries/user_agent.html

Upvotes: 1

Related Questions