Tworze sklep internetowy, w którym koszyk jest zaimplementowany jako klasa w pliku classes.php. Po dołączeniu pliku classes.php ( include("classes.php"); ) wywala mi na ekran kod klasy. Czy ktoś wie może czego to może być przyczyna?
classes.php:
<?
class cart
{
var $customer;
function cart($idd)
{
$this->customer=$idd;
}
function add_to_cart($prod)
{
unset($this->content[$prod->id-1
]); $this->content[$prod->id-1]=$prod;
}
function remove_from_cart($idd)
{
unset($this->content[$idd-1
]); }
function view_cart()
{
$a=4;
for($i=0;$i<=$a;$i++)
{
if(isset($this->content[$i])) { echo "klucz:".$i; echo " id: ".$this->content[$i]->id; echo " nazwa:".$this->content[$i]->name."<br>"; } }
}
function clear_cart()
{
$a=4;
for($i=0;$i<=$a;$i++) unset($this->content[$i]); }
function view_details($idd)
{
}
}
class product
{
var $id;
var $category_id;
var $name;
var $description;
var $quantity;
var $manyfacturer;
var $price;
var $discount;
function product($idd)
{
$this->id=$idd;
if($q=mysql_query("SELECT * FROM ec_product WHERE id='$idd'")) {
{
$this->set_category_id($w['category_id']);
$this->set_name($w['name']);
$this->set_description($w['description']);
$this->set_quantity($w['quantity']);
$this->set_manufacturer($w['manufacturer']);
$this->set_price($w['price']);
$this->set_discount($w['discount']);
}
else
{
echo "<br>Błąd bazy danych - nie pobrano wiersza<br>"; }
}
else
{
echo "<br>Błąd bazy danych - nie wykonane zapytanie<br>"; }
}
function set_category_id($cat_idd)
{
$this->category_id=$cat_idd;
}
function set_name($nam)
{
$this->name=$nam;
}
function set_description($desc)
{
$this->description=$desc;
}
function set_quantity($qt)
{
$this->quantity=$qt;
}
function set_manufacturer($man)
{
$this->manufacturer=$man;
}
function set_price($pr)
{
$this->price=$pr;
}
function set_discount($disc)
{
$this->discount=$disc;
}
}
?>
poprawiam
to juz drugie upomnienie ...
---
nospor