is there a short code trick to check if a session has started and if not then load one? Currently I receive an error \"session already started...\" if I put in a session sta
try this condition
if (version_compare(phpversion(), '5.4.0', '<')) { if(session_id() == '') { session_start(); } }else{ if (session_status() == PHP_SESSION_NONE) { session_start(); } }
If you only want to avoid the error, use @ before the function example:
@session_start();