I'm trying to create a unique session depending on a customers ID.
session_start();
$_SESSION['ORDER$customer_id']="xyz";
However, whenever I access the session, I get the same data regardless of the $customer_id.
I'm new to sessions. I'm sure I'm missing something. Can anyone point the way?
Single quotes don't allow for the var inside the quotes. Use double quote like this,
$_SESSION["ORDER$customer_id"]="xyz";
You should use $_SESSION["ORDER${customer_id}"] or $_SESSION['ORDER'.$customer_id].
Other people have answered the exact problem, but I have a feeling that you may be misunderstanding PHP's sessions.
Sessions are unique to each person accessing your site. You won't be able to (by default) access other sessions. This means that your array keys in $_SESSION don't have to be unique across every session currently acive.
The $_SESSION superglobal stores data specific to that person accessing your site. What you probably want to do is: $_SESSION['customer_id'] = 'xyz';
I just don't see how $_SESSION["ORDER$customer_id"]="xyz";
would be useful in a real application. I could be wrong about your situation, but you said you are new to sessions, I am just remembering the mistakes I made once.