Moving to OOP hopefully!

Posted by Luke on Stack Overflow See other posts from Stack Overflow or by Luke
Published on 2010-05-01T01:13:17Z Indexed on 2010/05/01 1:17 UTC
Read the original article Hit count: 234

Filed under:

So I am trying to understand OOP more and use it.

The following code was written before i started using OOP.

//loop through all the users 
$game = "$_POST[Game]_teams";
$result = mysql_query("SELECT username FROM `users`") or die(mysql_error());
while( $row=mysql_fetch_assoc($result) )
{
    $u[] = $row['username'];
}

I have put the query into my database page like following:

   function selectAllUsers()
   {
        $q = "SELECT username FROM ".TBL_USERS."";
        mysql_query($q, $this->connection);
   }

I'm a little confused about how the rest could be different? Would it be? Is it possible for anyone to help me without more code or understanding of my structure?

© Stack Overflow or respective owner

Related posts about php