Hi all,
Basically, here's what I'm trying to do.
I have a DB table called products_ssd.
This table contains the columns named:
- id
- manufacturer
- item
- description
- price
- size
- pic
This table contains the information for SSD drives, from varying manufacturers.
Now, to the code I currently have.
I have created a parent class called SSD. The code is below:
class ssd{
public $item;
public $manufacturer;
public $pic;
public $description;
public $size;
public $price;
public function __construct(){
$q = mysql_query("SELECT * FROM product_ssd") or die(mysql_error());
while ($ssd = mysql_fetch_assoc($q))
{
$this->item = $ssd['item'];
$this->manufacturer = $ssd['manufacturer'];
$this->description = $ssd['description'];
$this->pic = $ssd['pic'];
$this->price = "$" . $ssd['price'];
$this->size = $ssd['size'];
}
}
}
This will get ALL the SSD drives from the database.
Next, I have a child class. The intent of this class is to get all the SSD drives, from the manufacturer named OCZ:
class ocz extends ssd{
public function show(){
echo $this->item;
}
}
As it is right now, it will echo out ALL the item columns, regardless of manufacturer.
How can I adjust the OCZ class so that it modifies the MySQL query to select only items where manufacturer = 'OCZ'?
Thanks in advance for any advice!