title: how can i get the user data or info according to its student id?
body: <p>the flow goes like this, login(login.php)->change password(changepass.php), where every user must change their password->redirect on the homepage(homepage.php)where user can view his/her accnt details....what i want on my homepage is that, to greet the user according to its info or studentid with its complete name, but only i could show is the student id of the user as i echo the session. heres my code for my homepage.php</p>
  
  <pre><code>       &lt;?php session_start(); ?&gt;
         &lt;?php require('connect/connect.php'); ?&gt;
         &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"                 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
         &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
        &lt;head&gt;
         &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
        &lt;title&gt;Home Page&lt;/title&gt;
  
  
      &lt;link href="mm_spa.css" rel="stylesheet" type="text/css" /&gt;
        &lt;/head&gt;
  
           &lt;body class="oneColElsCtrHdr"&gt;
  
        &lt;td width="487" valign="top"&gt;
  
      &lt;?php
      // this is the session id where i could only get from the user(student id)
  echo $_SESSION['username'];
  $voter = $_SESSION['username'];
  function getuserinfo($info){
  
  $info_select = mysql_query ("SELECT `$info` FROM new_reg_student WHERE studid='$voter'");
  
       //this is my line 116 which i got an error saying 
       //Warning: mysql_query() expects parameter 1 to be string, 
       //resource given in C:\xampp\htdocs\project\homepage.php on line 116
  if ($query_get = mysql_query($info_select)) { 
  
  if ($result = mysql_result($query_get, 0, $info)) {
  return $result;
  }
  }
  
  }
  $fname = getuserinfo('fname');
  $lname = getuserinfo('lname');
  echo 'hello '. $fname .' '.$lname.'';
  
     ?&gt;
  
    &lt;/td&gt;
      &lt;div id="footer"&gt;
     &lt;p&gt;Footer&lt;/p&gt;
      &lt;!-- end #footer --&gt;&lt;/div&gt;
    &lt;!-- end #container --&gt;&lt;/div&gt;
     &lt;/body&gt;
    &lt;/html&gt;
  </code></pre>
  
  <p>heres the preview of my homepage.php</p>
  
  <p><img src="https://i.stack.imgur.com/eQsMk.jpg" alt="homepage preview"></p>