Hi there Charlie,
It does make sense, but you need to grab the id from the cookie, and not MySQL.
Someone is going to have to post how to do it correctly if I'm wrong about this, as I can no longer rembmer, but I wrote a script that used something like:
$client_id = $_COOKIE['client_id'];
I think that was how I did it. Just make sure the cookie actually has the client_id and not the client_name 🙂 If your cookie holds the client name, then you'll need to alter your WHERE clause in the mysql query to the name field, then add the client_id to the list of values it grabs.
thanks,
json