William Kinaan
William Kinaan

Reputation: 28799

php session have to start but when it starts give exception

i have a site, with many tabs , when i open any tab i want to get some data from session, but that data can't be got without session_start(); and when i put session_start() , an exception thrown tell me that the session is already starts

this is the exception

A session had already been started - ignoring session_start()

Upvotes: 1

Views: 69

Answers (2)

Concordus Applications
Concordus Applications

Reputation: 987

You should check to see if the session is set before starting the session.

if(!isset($_SESSION)){
    session_start();
}

Upvotes: 1

jbnunn
jbnunn

Reputation: 6355

You can begin with

if(!$_SESSION) {
    session_start();
}

or,

@session_start();

The "@" supresses errors.

Upvotes: 1

Related Questions