开发者

How to display data on the page without putting code to display data in class definition

I have function with simple sql query to list tickets on the page:

class DBQuery
{
  function displayTicketsList(){
    $this->dbConnection();
    $query = "SELECT * FROM tickets";
    $this->result = mysql_query($query);
    $this->dbClose();
  }
.
.
.
}

How to display data on the 开发者_StackOverflow社区page without putting code to display in class definition.


Your question isn't that clear, but I think you mean something like this:

class DBQuery
{
  function displayTicketsList(){
    $this->dbConnection();
    $query = "SELECT * FROM tickets";
    $this->result = mysql_query($query);
    $this->dbClose();

    return $this->result;

  }
.
.
.
}

and then in your "view", or whatever:

$myClass=new DBQuery;
$foo=$myClass->displayTicketsList();

print_r($foo);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜