Jump to content

Hi, i can't display a result from a parent class ? ... see below


jd2007

Recommended Posts

<?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 ?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.