function _DatabaseHandler::get_student_name

4.x _DatabaseHandler.php _DatabaseHandler::get_student_name($cwid)
5.x _DatabaseHandler.php _DatabaseHandler::get_student_name($cwid)

Returns the student's first and last name, put together. Ex: John Smith or John W Smith.

Parameters

int $student_id:

Return value

string

File

classes/_DatabaseHandler.php, line 1023

Class

_DatabaseHandler

Code

function get_student_name($cwid) {

  // Let's perform our queries.
  $res = $this->db_query("SELECT * FROM users 
						          WHERE cwid = '?'
						          AND is_student = 1 ", $cwid);

  $cur = $this->db_fetch_array($res);
  $name = $cur ["f_name"] . " " . $cur ["l_name"];

  // Force into pretty capitalization.
  // turns JOHN SMITH into John Smith	
  $name = ucwords(strtolower($name));

  return trim($name);
}