开发者

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

开发者 https://www.devze.com 2023-02-09 11:43 出处:网络
I have function with simple sql query to list tickets on the page: class DBQuery { function displayTicketsList(){

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

精彩评论

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

关注公众号