I have some basic session handling in my application. In each page I check if the user is logged in. If they are then they're already identified by
$_SESSION['user_id'], and their login/logout is recorded in a MySQL table.
I would also like to record visits by guests (not logged in) based on a unique id.
I had assumed that once
session_start() is called that an internal
session_id is automatically generated and that calling
session_id() I could retrieve this. But this just gives an "undefined variable" error, so I guess I have to set it manually..? If so then what's the best way so that it will be a unique ID, or what is the usual method?
Thanks for any help...