在MySQL查询中使用会话

I have a blog site with all the blog stuff including a post page the problem is i'm trying to use a php session to select a table in my database i am kinda a major noob in this but tried mysql_query("SELECT * FROM $_SESSION['SESS_LOGIN']_blog") this didn't work so i tried $user = $_SESSION['SESS_LOGIN']; $blog = _blog; "mysql_query("SELECT * FROM $user . '' . $blog") and still nothing any help would be greatly appreciated

Because of the ambiguity in the string interpolation, you need to wrap it in braces like this...

mysql_query("SELECT * FROM {$_SESSION['SESS_LOGIN']}_blog");

Something like this:

$userblog = $_SESSION['SESS_LOGIN'] . '_blog';
mysql_query("SELECT * FROM $userblog");

Note that it's probably a terrible idea to have one database table per user. The database structure should not depend on dynamic data like that.