class and object in php
I am a fan of loose coupling so I would suggest that you take the values of host, username, password and database out of your class. Pass the values through the constructor and set them in the constructor. This makes it easier to reuse your code.

Second, in classes such as one that creates a connection to a database I would not "echo" stuff. You better throw exceptions on error or return meaningful values to the caller.

Last, I'd suggest other names. This might be nitpicking but this has more meaning to me:

$connection = new DatabaseConnection();
$connection-&gt;open();
$connection-&gt;connectDatabase();


So, wrapped up I would have something like:

&lt;?php
class DatabaseConnection
{
    var $host;
    var $username;
    var $password;
    var $database;
    var $myconn;

    function __construct($dbhost, $user, $pass, $db)
    {
        $this-&gt;host = $dbhost;
        $this-&gt;username = $user;
        $this-&gt;password = $pass;
        $this-&gt;database = $db;
    }

    function open()
    {
        $conn = mysql_connect($his-&gt;host,$this-&gt;username,$this-&gt;password);
        if (!$conn)
            throw new Exception('Error establishing a connection.');
        else
            $this-&gt;myconn = $conn;

        return $this-&gt;myconn;
    }

    function connectDatabase()
    {
        mysql_select_db($this-&gt;database);
        if(mysql_error())
            throw new Exception("Cannot find the database " . $this-&gt;database);
    }

    function selectData($query)
    {
        mysql_select_db($this-&gt;database);
        $result = mysql_query($query);
        return $result;
    }

    function closeConnection()
    {
        mysql_close($this-&gt;myconn);
    }
}
?&gt;


Usage:

$connection = new DatabaseConnection("localhost", "root", "", "wilbert");
$connection-&gt;open();
$connection-&gt;connectDatabase();
$connection-&gt;selectData("SELECT a.student_id, a.FirstName, b.First_Name FROM Student a LEFT JOIN teacher b ON a.student_id = b.student_id");


See how the other names make more sense? Try to avoid verbs as a classname. Methods can and most likely will be or contain verbs, but not classnames. Also, leaving the query out of the class leaves you the option to use the same code for other queries. 

Note that this is no perfect code, I was only suggesting what might be changed. Hope this helps! :)

Edit:

You call the function selectData() and pass the query-string as a parameter. This changes nothing, it gives the same result as your code. Only in my case you can pass other queries to the function whereas your function is limited to the embedded query.

Now for the result. This has also to do with the decoupling of your connection-class and what will be shown to the user. I showed u the usage of the class, the code below is how you can process the result. Create a function (but not in the connection class!) that returns the result in a table:

function resultTable($sqlResult)
{
    $table = "&lt;table border='1'&gt;";
    $table .= "&lt;tr&gt;&lt;th&gt;Student_ID&lt;/th&gt;&lt;th&gt;First_Name&lt;/th&gt;&lt;th&gt;First_Name&lt;/th&gt;&lt;/tr&gt;";

    while($row = mysql_fetch_array($sqlResult))
    {
        $table .= "&lt;tr&gt;&lt;td&gt;" . $row['student_id']. "&lt;/td&gt;";
        $table .= "&lt;td&gt;" . $row['FirstName'] . "&lt;/td&gt;";
        $table .= "&lt;td&gt;" . $row['First_Name'] . "&lt;/td&gt;&lt;/tr&gt;";
    }
    $table .= "&lt;/table&gt;";

    return $table;
}


And the usage:

$connection = new DatabaseConnection("localhost", "root", "", "wilbert");
$connection-&gt;open();
$connection-&gt;connectDatabase();
$result = $connection-&gt;selectData("SELECT a.student_id, a.FirstName, b.First_Name FROM Student a LEFT JOIN teacher b ON a.student_id = b.student_id");
echo resultTable($result);


You could create a new class in which you define all sorts of methods like these to process a result and return it to the view-file where you will show it on the screen. Hope this clarifies it. :)