I am trying to learn OOP and I am in that experimenting stage where I just try whatever.
Should I keep the class below?
PHP Code:
class Query
{
var $table;
var $where;
var $id;
function mysql_get_row()
{
$getuser = mysql_query("SELECT * FROM ".$this->table." WHERE ".$this->where." = '".$this->id."' ")or die(mysql_error());
return mysql_fetch_array($getuser);
}
}
$ah = new Query;
$ah->table = "user";
$ah->where = "userid";
$ah->id = 1;
$row = $ah->mysql_get_row();
echo "User ID: ".$row['userid']."<br />
Username: ".$row['username']." <br />
Posts: ".$row['posts']."<br />";