The class has 6 private member variables:
1. Shop Order
2. Customer
3. Part ID
4. Pieces
5. Bins
6. Loads
Basically, I'm using the shop order number to look up the other 5 fields in a database stored on an IBM iSeries (where shop order number is the primary key for the table). The database operations are no problem (using Windows 2000 and a System DSN, I can easily connect and query through ODBC).
The problem I'm having, though, is that when I assign a value to shop order, for example, in my constructor (which requires the shop order be given), it assigns the same value to customer, part id, pieces, bins, and loads. Then, if I try to assign a different value to customer, it assigns the value to all six fields. I must be doing something wrong, but can't for the life of me figure out what.
Here's my class code:
Code: Select all
<?php
/***********************************
* definition of class VMSShopOrder *
***********************************/
class VMSShopOrder
{
//private members
//---------------
private $shopOrder = ""; //shop order number (given by user)
private $customer = ""; //customer code (from iSeries -> shopOrder)
private $partId = ""; //part id (from iSeries -> shopOrder)
private $pieces = 0; //# pieces (from iSeries -> shopOrder)
private $bins = 0; //# bins (from iSeries -> shopOrder)
private $loads = 0; //# loads (from iSeries -> shopOrder)
/***********************
* Default constructor. *
***********************/
function __construct($initShopOrder)
{
//as long as object defined
if (isset($this))
{
print("Shop order: " . $this->$shopOrder . "<br>");
print("Customer: " . $this->$customer . "<br>");
//set the shop order to the passed value
$this->$shopOrder = $initShopOrder;
print("Shop order: " . $this->$shopOrder . "<br>");
print("Customer: " . $this->$customer . "<br>");
//the rest of the constructor goes here
}
}
}
?>Code: Select all
Shop order:
Customer:
Shop order: 123456
Customer 123456