Global Variable in PHP for Login and SQL Query
<p>After logging in from a PHP Form a cookie is set which contains the <code>admin_id</code> value.</p>

<p>My PHP application retrieves it from cookies and stores the value of cookie in variable lets say <code>$admin_id=$_COOKIE[admin_id]</code>.</p>

<p>I will be using it in PHP SQL Query such as <code>select * from $table where admin_id='$admin_id' and  id = '$id'</code></p>

<p>I have a common <code>head.php</code> file being called before all the files.</p>

<p>Once the value is stored in variable <code>$admin_id</code> it should be globally accessible throughout the entire application of PHP of various queries in different functions and files. How can I do it so?</p>