classes?
| From: | Kurth Bemis | Date: | Thu, 16 Nov 2000 06:16:59 +0000 |
| Subject: | classes? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-25624@lists.php.net to get a copy of this message | ||
ok all i'm just starting to get involved with classes...and have a slight problem......i don't understand how to access functions..i have been reading the manual at php.net but that confuses even more....take a look at some code i wrote...
print "<a href=\"$PHP_SELF?product=$product&quanity=1\">$title - $price</a>";
thats to add a item to my cart......
the class function looks like this...
function add_item($table, $session, $product, $quantity) {
$qty = $this->check_item($table, $session, $product);
if($qty == 0) {
$query = "INSERT INTO $table (session, product, quantity) VALUES ";
$query .= "('$session', '$product', '$quantity') ";
mysql_query($query);
} else {
$quantity += $qty;
$query = "UPDATE $table SET quantity='$quantity' WHERE session='$session' AND ";
$query .= "product='$product' ";
mysql_query($query);
}
}
my question is how to i pass that vars that i need to the class? am i making sense here?
~kurth
Kurth Bemis - Network/Systems Administrator, USAExpress.net/Ozone Computer
There is no sin except stupidity. -- Oscar Wilde
kurth@usaexpress.net | http://www.usaexpress.net/kurth
PGP key available - http://www.usaexpress.net/kurth/pgp
Fight Weak Encryption! Donate your wasted CPU cycles to Distributed.net (http://www.distributed.net)