| SaintIsaiah |
04-04-2010 05:28 AM |
Problem with sql result echo
I'm modifying a CMS to create an if/else statement to prevent a journalist who is not an editor from seeing any articles except the ones they made. However, it seems that the code I made to get their usergroup ID is not getting the result to use for the if/else statement. I'm trying just to echo the user's group id to see if it just works first so I can continue finishing the code. Here's what I got.
PHP Code:
$usernamesql = $userinfo['username']; //$userinfo['username'] is defined in another part of the page and already works
$getugroupid = mysql_query("SELECT * FROM pam_users WHERE username = '.$usernamesql.'"); //Trying to select all of the user's info in the DB
$ugroupid = mysql_fetch_array($getugroupid); //Trying to create an array to echo values from
echo '<center><h1>'. $ugroupid['usergroupid'] .'</h1></center>';//'usergroupid' is the name of the column in the db containing that user's group id number
However, it never shows the user's group id. Any idea what I'm doing wrong?
|