PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
pelegk2
Forum Regular
Posts: 633 Joined: Thu Nov 27, 2003 5:02 am
Location: Israel - the best place to live in after heaven
Contact:
Post
by pelegk2 » Mon Nov 08, 2004 8:55 am
i have mdae this class :
Code: Select all
<?php
class purchise_prev{
var $status;
function purchise_prev($_status){
$this->$status=$_status;
}
function get_status() { return $this->$status ; }
}
?>
and
Code: Select all
<?php
$pur_prev = new purchise_prev($row1['status']);
?>
when i try to access the class :
iget
Notice: Undefined variable: status in C:\Program Files\Apache Group\Apache2\htdocs\purchise_new\order_form.php on line 73
where lines 73 is in the get_status()
why is that?
thnaks i nadvance
peleg
phpScott
DevNet Resident
Posts: 1206 Joined: Wed Oct 09, 2002 6:51 pm
Location: Keele, U.K.
Post
by phpScott » Mon Nov 08, 2004 9:56 am
when using the this key word you don't need to do $this->$status you have to $this->status;
remove the $ infront of status in your class in both methods.
kettle_drum
DevNet Resident
Posts: 1150 Joined: Sun Jul 20, 2003 9:25 pm
Location: West Yorkshire, England
Post
by kettle_drum » Mon Nov 08, 2004 9:58 am
pelegk2
Forum Regular
Posts: 633 Joined: Thu Nov 27, 2003 5:02 am
Location: Israel - the best place to live in after heaven
Contact:
Post
by pelegk2 » Mon Nov 08, 2004 11:22 am