jd2007 Posted August 17, 2007 Share Posted August 17, 2007 <?php /** * @author * @copyright 2007 */ class ConnectDB { private $localhost; private $user; private $pass; private $db; private $con; private $data; private $table; private $id; private $str; private $que; private $res; function __construct($l, $u, $p, $d) { $this->localhost=$l; $this->user=$u; $this->pass=$p; $this->db=$d; } function connectdb() { $this->con=mysql_connect($this->localhost, $this->user, $this->pass); $this->data=mysql_select_db($this->db, $this->con); } function queryMachine($a, $b="", $c="") { $this->table=$a; $this->id=$b; $this->str=$c; $this->que="select $this->str from $this->table where id='$this->id'"; $this->res=mysql_query($this->que); $this->row=mysql_fetch_row($this->res); } function showResult() { echo $this->row; } /* function modifyResultDisp() { $this->row; }*/ } ?> <?php /** * @author * @copyright 2007 */ include("connectdb.php"); class FlashProfile extends ConnectDB { private $arr; function title($table, $id, $str) { $this->queryMachine($table, $id, $str); $this->arr=$this->showResult(); echo $this->arr[0]; } } ?> i want $this->showResult() put the value in $this->arr, the value is a array and echo the first element of the array but all i get is the word Array...why...pls help ? Link to comment https://forums.phpfreaks.com/topic/65399-hi-i-cant-display-a-result-from-a-parent-class-see-below/ Share on other sites More sharing options...
jd2007 Posted August 17, 2007 Author Share Posted August 17, 2007 pls help me... Link to comment https://forums.phpfreaks.com/topic/65399-hi-i-cant-display-a-result-from-a-parent-class-see-below/#findComment-326559 Share on other sites More sharing options...
bache Posted August 17, 2007 Share Posted August 17, 2007 Do you open a connection before trying to fetch result from the DB? Link to comment https://forums.phpfreaks.com/topic/65399-hi-i-cant-display-a-result-from-a-parent-class-see-below/#findComment-326666 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.