Re: [PHP] OOP in PHP
what sort of error are you encountering ? -nathan On 8/15/07, Patrik Hasibuan [EMAIL PROTECTED] wrote: Dear my friends, This is the first time for me to use OOP concept of PHP. I wrote still a very simple codes but it doesn't work as my manual book taught. the book titled MySQL/PHP Database Application by Jay Greenspan say these lines should work but in fact it don't work as expected. Here is my code: === //pelangganbaru.php ?php require koneksi.php; $sqlnya=select country from countries; $klas=new koneksi($sqlnya); ? === //koneksi.php !DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN HTML HEAD META name=generator content=HTML Tidy for Linux/x86 (vers 31 October 2006), see www.w3.org /HEAD BODY ?php class koneksi{ $namakompie=127.0.0.1; $un=root; $pw=mysqlpw; $sqlnya; $kueri; function koneksi($sqlnya){ echo superclass koneksi dipanggilbr; $konek=mysql_connect($namakompie,$un,$pw); if ($konek){ echo koneksi berhasil (connection succeeded)br; $mybd=mysql_select_db(survey,$konek); $kueri=mysql_query($sqlnya,$konek); }else{ echo I can't talk to the serverbr; exit(); } return $kueri; } } ? /BODY /HTML = Theoritically if Class koneksi is being initialized than it prints koneksi berhasil (connection succeeded) but it doesn't. Please tell me what is my mistake. Thank you very much in advance. -- Patrik Hasibuan [EMAIL PROTECTED] Junior Programmer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OOP in PHP
Theoritically if Class koneksi is being initialized than it prints koneksi berhasil (connection succeeded) but it doesn't. What does it? Just nothing? No warnings at all? Possibly disabled? so far rob -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OOP in PHP
A few missing pieces in your code. Take a look below within your class. I corrected it. try also using include_once instead of require and make sure that your error level and reporting are turned on so you can see what is happening. Patrik Hasibuan wrote: Dear my friends, This is the first time for me to use OOP concept of PHP. I wrote still a very simple codes but it doesn't work as my manual book taught. the book titled MySQL/PHP Database Application by Jay Greenspan say these lines should work but in fact it don't work as expected. Here is my code: === //pelangganbaru.php ?php require koneksi.php; $sqlnya=select country from countries; $klas=new koneksi($sqlnya); ? === //koneksi.php !DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN HTML HEAD META name=generator content=HTML Tidy for Linux/x86 (vers 31 October 2006), see www.w3.org /HEAD BODY ?php class koneksi{ $namakompie=127.0.0.1; var $namakompie='127.0.0.1'; $un=root; var $un='root'; $pw=mysqlpw; var $pw='mysqlpw'; $sqlnya; var $sqlnya; $kueri; var $kueri; function koneksi($sqlnya){ echo superclass koneksi dipanggilbr; $konek=mysql_connect($namakompie,$un,$pw); $konek=mysql_connect($this-namakompie, $this-un, $this-pw); if ($konek){ echo koneksi berhasil (connection succeeded)br; $mybd=mysql_select_db(survey,$konek); $kueri=mysql_query($sqlnya,$konek); }else{ echo I can't talk to the serverbr; exit(); } return $kueri; } } ? /BODY /HTML = Theoritically if Class koneksi is being initialized than it prints koneksi berhasil (connection succeeded) but it doesn't. Please tell me what is my mistake. Thank you very much in advance. -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OOP in PHP
Dear Jim, You've solved my problem, Jim. Thank you very much. Now, my code give the output as my expectation: superclass koneksi dipanggil koneksi berhasil negara- . But come another problem, namely: the $negara is empty. I tried to read the documentation on http://www.php.net/manual/en/language.types.object.php#language.types.object.casting but I didn't manage to find the answer. I suspect the return $kueri could be only for 'returning' a variable of boolean or string or number but not 'returning' an array (such as the result of mysql_query(select country from countries,$koneksi) ) or an object (such as the result of mysql_connect() ). So how should I get the content of mysql_query() so I can get the value with mysql_fetch_row() or inherit array? Is is also possible to re-use the result of mysql_connect() or inherit the $konek? Here is my current code: //pelangganbaru.php ?php include_once koneksi.php; $sqlnya=select country from countries; $klas=new koneksi($sqlnya); $brs=mysql_fetch_row($klas-kueri); list($negara)=$brs; echo option value=\$negara\$negara/option; ? = //koneksi.php !DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN HTML HEAD META name=generator content=HTML Tidy for Linux/x86 (vers 31 October 2006), see www.w3.org /HEAD BODY ?php class koneksi{ var $namakompie=127.0.0.1; var $un=root; var $pw=mysuccess; var $sqlnya; var $kueri; function koneksi($sqlnya){ echo superclass koneksi dipanggilbr; $konek=mysql_connect($this-namakompie,$this-un,$this-pw); if ($konek){ echo koneksi berhasilbr; $mybd=mysql_select_db(survey,$konek); $kueri=mysql_query($sqlnya,$konek); }else{ echo I can't talk to the serverbr; exit(); } return $kueri; } } ? /BODY /HTML Please keep telling me. Thank you very much in advance. ps: Thanks a lot too to Nathan Nobe and Robert Gegen for their responds... On Wed, 15 Aug 2007 09:00:56 -0700 Jim Lucas [EMAIL PROTECTED] wrote: A few missing pieces in your code. Take a look below within your class. I corrected it. try also using include_once instead of require and make sure that your error level and reporting are turned on so you can see what is happening. Patrik Hasibuan wrote: Dear my friends, This is the first time for me to use OOP concept of PHP. I wrote still a very simple codes but it doesn't work as my manual book taught. the book titled MySQL/PHP Database Application by Jay Greenspan say these lines should work but in fact it don't work as expected. Here is my code: === //pelangganbaru.php ?php require koneksi.php; $sqlnya=select country from countries; $klas=new koneksi($sqlnya); ? === //koneksi.php !DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN HTML HEAD META name=generator content=HTML Tidy for Linux/x86 (vers 31 October 2006), see www.w3.org /HEAD BODY ?php class koneksi{ $namakompie=127.0.0.1; var $namakompie='127.0.0.1'; $un=root; var $un='root'; $pw=mysqlpw; var $pw='mysqlpw'; $sqlnya; var $sqlnya; $kueri; var $kueri; function koneksi($sqlnya){ echo superclass koneksi dipanggilbr; $konek=mysql_connect($namakompie,$un,$pw); $konek=mysql_connect($this-namakompie, $this-un, $this-pw); if ($konek){ echo koneksi berhasil (connection succeeded)br; $mybd=mysql_select_db(survey,$konek); $kueri=mysql_query($sqlnya,$konek); }else{ echo I can't talk to the serverbr; exit(); } return $kueri; } } ? /BODY /HTML = Theoritically if Class koneksi is being initialized than it prints koneksi berhasil (connection succeeded) but it doesn't. Please tell me what is my mistake. Thank you very much in advance. -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Patrik Hasibuan [EMAIL PROTECTED] Junior Programmer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OOP in PHP
Patrik Hasibuan wrote: Dear Jim, You've solved my problem, Jim. Thank you very much. Now, my code give the output as my expectation: superclass koneksi dipanggil koneksi berhasil negara- . But come another problem, namely: the $negara is empty. I tried to read the documentation on http://www.php.net/manual/en/language.types.object.php#language.types.object.casting but I didn't manage to find the answer. I suspect the return $kueri could be only for 'returning' a variable of boolean or string or number but not 'returning' an array (such as the result of mysql_query(select country from countries,$koneksi) ) or an object (such as the result of mysql_connect() ). So how should I get the content of mysql_query() so I can get the value with mysql_fetch_row() or inherit array? Is is also possible to re-use the result of mysql_connect() or inherit the $konek? Here is my current code: //pelangganbaru.php ?php include_once koneksi.php; $sqlnya=select country from countries; $klas=new koneksi($sqlnya); Try this instead if ( mysql_num_rows($klas) 0 ) { while( list($negara) = mysql_fetch_row($klas) ) { echo option value=\$negara\$negara/option; } } else { echo 'No results found'; } And within your class change your mysql_query line to this $kueri=mysql_query($sqlnya,$konek) or die('MYSQL QUERY ERROR ['.mysql_errno($konek).'] '.mysql_error($konek)); This will make the system fail and kill the script if the query fails for some reason. The die() part will then print the error number and what mysql thinks is wrong. This isn't the best way to use error reporting in a production system, but since you are new at this, this is a simple way to do error reporting. It is always a good idea to use is_resource($resource_handle_from_mysql) as a test to see if you did in fact get a valid resource id from the mysql_connect() call. $brs=mysql_fetch_row($klas-kueri); list($negara)=$brs; echo option value=\$negara\$negara/option; ? = //koneksi.php !DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN HTML HEAD META name=generator content=HTML Tidy for Linux/x86 (vers 31 October 2006), see www.w3.org /HEAD BODY ?php class koneksi{ var $namakompie=127.0.0.1; var $un=root; var $pw=mysuccess; var $sqlnya; var $kueri; function koneksi($sqlnya){ echo superclass koneksi dipanggilbr; $konek=mysql_connect($this-namakompie,$this-un,$this-pw); if ($konek){ echo koneksi berhasilbr; $mybd=mysql_select_db(survey,$konek); $kueri=mysql_query($sqlnya,$konek); }else{ echo I can't talk to the serverbr; exit(); } return $kueri; } } ? /BODY /HTML Please keep telling me. Thank you very much in advance. ps: Thanks a lot too to Nathan Nobe and Robert Gegen for their responds... On Wed, 15 Aug 2007 09:00:56 -0700 Jim Lucas [EMAIL PROTECTED] wrote: A few missing pieces in your code. Take a look below within your class. I corrected it. try also using include_once instead of require and make sure that your error level and reporting are turned on so you can see what is happening. Patrik Hasibuan wrote: Dear my friends, This is the first time for me to use OOP concept of PHP. I wrote still a very simple codes but it doesn't work as my manual book taught. the book titled MySQL/PHP Database Application by Jay Greenspan say these lines should work but in fact it don't work as expected. Here is my code: === //pelangganbaru.php ?php require koneksi.php; $sqlnya=select country from countries; $klas=new koneksi($sqlnya); ? === //koneksi.php !DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN HTML HEAD META name=generator content=HTML Tidy for Linux/x86 (vers 31 October 2006), see www.w3.org /HEAD BODY ?php class koneksi{ $namakompie=127.0.0.1; var $namakompie='127.0.0.1'; $un=root; var $un='root'; $pw=mysqlpw; var $pw='mysqlpw'; $sqlnya; var $sqlnya; $kueri; var $kueri; function koneksi($sqlnya){ echo superclass koneksi dipanggilbr; $konek=mysql_connect($namakompie,$un,$pw); $konek=mysql_connect($this-namakompie, $this-un, $this-pw); if ($konek){ echo koneksi berhasil (connection succeeded)br; $mybd=mysql_select_db(survey,$konek); $kueri=mysql_query($sqlnya,$konek); }else{ echo I can't talk to the serverbr; exit(); } return $kueri; } } ? /BODY /HTML = Theoritically if Class koneksi is being initialized than it prints koneksi berhasil (connection succeeded) but it doesn't. Please tell me what is my mistake. Thank you very much in advance. -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
Re: [PHP] OOP in PHP
Dear Jim, thanks for your help. I've modified my codes as you adviced. But than the output is: superclass koneksi dipanggil koneksi berhasil No results found The column 'country' of table 'countries' already really contents complete all contry name from all over the earth. How come the query of select country from countries results empty value. So I believe the problem is still on the my OOP programming because if I do the query only with the procedural concept the $kueri will content the complete record of the column country. Please keep telling what is my mistake on my OOP PHP5 codes. - //pelangganbaru.php ?php include_once koneksi.php; $sqlnya=select * from countries; $klas=new koneksi($sqlnya); if ( mysql_num_rows($klas) 0 ) { while( list($negara) = mysql_fetch_row($klas) ) { echo negara-$negarabr; } } else { echo 'No results found'; } ? - //koneksi.php !DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN HTML HEAD META name=generator content=HTML Tidy for Linux/x86 (vers 31 October 2006), see www.w3.org /HEAD BODY ?php class koneksi{ var $namakompie=127.0.0.1; var $un=root; var $pw=mysuccess; var $sqlnya; var $kueri; function koneksi($sqlnya){ echo superclass koneksi dipanggilbr; $konek=mysql_connect($this-namakompie,$this-un,$this-pw); if ($konek){ echo koneksi berhasilbr; $mybd=mysql_select_db(survey,$konek); //$kueri=mysql_query($sqlnya,$konek); $kueri=mysql_query($sqlnya,$konek) or die('MYSQL QUERY ERROR ['.mysql_errno($konek).'] '.mysql_error($konek)); }else{ echo I can't talk to the serverbr; exit(); } return $kueri; } } ? /BODY /HTML === On Wed, 15 Aug 2007 13:13:18 -0700 Jim Lucas [EMAIL PROTECTED] wrote: Patrik Hasibuan wrote: Dear Jim, You've solved my problem, Jim. Thank you very much. Now, my code give the output as my expectation: superclass koneksi dipanggil koneksi berhasil negara- . But come another problem, namely: the $negara is empty. I tried to read the documentation on http://www.php.net/manual/en/language.types.object.php#language.types.object.casting but I didn't manage to find the answer. I suspect the return $kueri could be only for 'returning' a variable of boolean or string or number but not 'returning' an array (such as the result of mysql_query(select country from countries,$koneksi) ) or an object (such as the result of mysql_connect() ). So how should I get the content of mysql_query() so I can get the value with mysql_fetch_row() or inherit array? Is is also possible to re-use the result of mysql_connect() or inherit the $konek? Here is my current code: //pelangganbaru.php ?php include_once koneksi.php; $sqlnya=select country from countries; $klas=new koneksi($sqlnya); Try this instead if ( mysql_num_rows($klas) 0 ) { while( list($negara) = mysql_fetch_row($klas) ) { echo option value=\$negara\$negara/option; } } else { echo 'No results found'; } And within your class change your mysql_query line to this $kueri=mysql_query($sqlnya,$konek) or die('MYSQL QUERY ERROR ['.mysql_errno($konek).'] '.mysql_error($konek)); This will make the system fail and kill the script if the query fails for some reason. The die() part will then print the error number and what mysql thinks is wrong. This isn't the best way to use error reporting in a production system, but since you are new at this, this is a simple way to do error reporting. It is always a good idea to use is_resource($resource_handle_from_mysql) as a test to see if you did in fact get a valid resource id from the mysql_connect() call. $brs=mysql_fetch_row($klas-kueri); list($negara)=$brs; echo option value=\$negara\$negara/option; ? = //koneksi.php !DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN HTML HEAD META name=generator content=HTML Tidy for Linux/x86 (vers 31 October 2006), see www.w3.org /HEAD BODY ?php class koneksi{ var $namakompie=127.0.0.1; var $un=root; var $pw=mysuccess; var $sqlnya; var $kueri; function koneksi($sqlnya){ echo superclass koneksi dipanggilbr; $konek=mysql_connect($this-namakompie,$this-un,$this-pw); if ($konek){ echo koneksi berhasilbr; $mybd=mysql_select_db(survey,$konek); $kueri=mysql_query($sqlnya,$konek); }else{ echo I can't talk to the serverbr; exit(); } return $kueri; } } ? /BODY /HTML Please keep telling me. Thank you very much in advance. ps: Thanks a lot too to Nathan Nobe and Robert Gegen for their responds... On Wed, 15 Aug 2007 09:00:56 -0700 Jim Lucas [EMAIL PROTECTED] wrote: A few missing pieces in your code.
Re: [PHP] OOP in PHP
Patrik Hasibuan wrote: Dear Jim, thanks for your help. I've modified my codes as you adviced. But than the output is: superclass koneksi dipanggil koneksi berhasil No results found The column 'country' of table 'countries' already really contents complete all contry name from all over the earth. How come the query of select country from countries results empty value. So I believe the problem is still on the my OOP programming because if I do the query only with the procedural concept the $kueri will content the complete record of the column country. Please keep telling what is my mistake on my OOP PHP5 codes. - //pelangganbaru.php ?php include_once koneksi.php; $sqlnya=select * from countries; ok, don't know why it took me this long to realize what the problem is. The following line will return the object of a the class that you are initializing, not the result set pointer. So, what you need to do is this Change this function koneksi($sqlnya){ ... } to this function getkoneksi($sqlnya) { ... } Then this $klas=new koneksi($sqlnya); to this $o = new koneksi(); $klas = $o-get_koneksi($sqlnya); Now all should work. $klas=new koneksi($sqlnya); if ( mysql_num_rows($klas) 0 ) { while( list($negara) = mysql_fetch_row($klas) ) { echo negara-$negarabr; } } else { echo 'No results found'; } ? - //koneksi.php !DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN HTML HEAD META name=generator content=HTML Tidy for Linux/x86 (vers 31 October 2006), see www.w3.org /HEAD BODY ?php class koneksi{ var $namakompie=127.0.0.1; var $un=root; var $pw=mysuccess; var $sqlnya; var $kueri; function koneksi($sqlnya){ echo superclass koneksi dipanggilbr; $konek=mysql_connect($this-namakompie,$this-un,$this-pw); if ($konek){ echo koneksi berhasilbr; $mybd=mysql_select_db(survey,$konek); //$kueri=mysql_query($sqlnya,$konek); $kueri=mysql_query($sqlnya,$konek) or die('MYSQL QUERY ERROR ['.mysql_errno($konek).'] '.mysql_error($konek)); }else{ echo I can't talk to the serverbr; exit(); } return $kueri; } } ? /BODY /HTML === On Wed, 15 Aug 2007 13:13:18 -0700 Jim Lucas [EMAIL PROTECTED] wrote: Patrik Hasibuan wrote: Dear Jim, You've solved my problem, Jim. Thank you very much. Now, my code give the output as my expectation: superclass koneksi dipanggil koneksi berhasil negara- . But come another problem, namely: the $negara is empty. I tried to read the documentation on http://www.php.net/manual/en/language.types.object.php#language.types.object.casting but I didn't manage to find the answer. I suspect the return $kueri could be only for 'returning' a variable of boolean or string or number but not 'returning' an array (such as the result of mysql_query(select country from countries,$koneksi) ) or an object (such as the result of mysql_connect() ). So how should I get the content of mysql_query() so I can get the value with mysql_fetch_row() or inherit array? Is is also possible to re-use the result of mysql_connect() or inherit the $konek? Here is my current code: //pelangganbaru.php ?php include_once koneksi.php; $sqlnya=select country from countries; $klas=new koneksi($sqlnya); Try this instead if ( mysql_num_rows($klas) 0 ) { while( list($negara) = mysql_fetch_row($klas) ) { echo option value=\$negara\$negara/option; } } else { echo 'No results found'; } And within your class change your mysql_query line to this $kueri=mysql_query($sqlnya,$konek) or die('MYSQL QUERY ERROR ['.mysql_errno($konek).'] '.mysql_error($konek)); This will make the system fail and kill the script if the query fails for some reason. The die() part will then print the error number and what mysql thinks is wrong. This isn't the best way to use error reporting in a production system, but since you are new at this, this is a simple way to do error reporting. It is always a good idea to use is_resource($resource_handle_from_mysql) as a test to see if you did in fact get a valid resource id from the mysql_connect() call. $brs=mysql_fetch_row($klas-kueri); list($negara)=$brs; echo option value=\$negara\$negara/option; ? = //koneksi.php !DOCTYPE html PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN HTML HEAD META name=generator content=HTML Tidy for Linux/x86 (vers 31 October 2006), see www.w3.org /HEAD BODY ?php class koneksi{ var $namakompie=127.0.0.1; var $un=root; var $pw=mysuccess; var $sqlnya; var $kueri; function koneksi($sqlnya){ echo superclass koneksi dipanggilbr; $konek=mysql_connect($this-namakompie,$this-un,$this-pw); if ($konek){ echo koneksi berhasilbr; $mybd=mysql_select_db(survey,$konek); $kueri=mysql_query($sqlnya,$konek); }else{ echo I can't
Re: [PHP] OOP in PHP
Jim Lucas wrote: Patrik Hasibuan wrote: Dear Jim, thanks for your help. I've modified my codes as you adviced. But than the output is: superclass koneksi dipanggil koneksi berhasil No results found The column 'country' of table 'countries' already really contents complete all contry name from all over the earth. How come the query of select country from countries results empty value. So I believe the problem is still on the my OOP programming because if I do the query only with the procedural concept the $kueri will content the complete record of the column country. Please keep telling what is my mistake on my OOP PHP5 codes. - //pelangganbaru.php ?php include_once koneksi.php; $sqlnya=select * from countries; ok, don't know why it took me this long to realize what the problem is. The following line will return the object of a the class that you are initializing, not the result set pointer. So, what you need to do is this Change this function koneksi($sqlnya){ ... } to this function getkoneksi($sqlnya) { oops this should be get_koneksi($sqlnya) ... } Then this $klas=new koneksi($sqlnya); to this $o = new koneksi(); $klas = $o-get_koneksi($sqlnya); Now all should work. -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OOP in PHP
Dear my friend, Jim Lucas. Thank you very much for your help. You've solved my problem one more time. I really appreciate your help. === On Wed, 15 Aug 2007 14:17:02 -0700 Jim Lucas [EMAIL PROTECTED] wrote: Jim Lucas wrote: Patrik Hasibuan wrote: Dear Jim, thanks for your help. I've modified my codes as you adviced. But than the output is: superclass koneksi dipanggil koneksi berhasil No results found The column 'country' of table 'countries' already really contents complete all contry name from all over the earth. How come the query of select country from countries results empty value. So I believe the problem is still on the my OOP programming because if I do the query only with the procedural concept the $kueri will content the complete record of the column country. Please keep telling what is my mistake on my OOP PHP5 codes. - //pelangganbaru.php ?php include_once koneksi.php; $sqlnya=select * from countries; ok, don't know why it took me this long to realize what the problem is. The following line will return the object of a the class that you are initializing, not the result set pointer. So, what you need to do is this Change this function koneksi($sqlnya){ ... } to this function getkoneksi($sqlnya) { oops this should be get_koneksi($sqlnya) ... } Then this $klas=new koneksi($sqlnya); to this $o = new koneksi(); $klas = $o-get_koneksi($sqlnya); Now all should work. -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Patrik Hasibuan [EMAIL PROTECTED] Junior Programmer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] OOP with PHP
Try it out for yourself. :- class Test{ var $x = ''; function Test(){} } $x = new Test(); $y = new Test(); $x-x = Way; $y-x = No; print $y-x . $x-x; --- Scott Hurring Systems Programmer EAC Corporation [EMAIL PROTECTED] Voice: 201-462-2149 Fax: 201-288-1515 -Original Message- From: Erik Price [mailto:[EMAIL PROTECTED]] Sent: Tuesday, May 21, 2002 2:14 PM To: [EMAIL PROTECTED] Subject: [PHP] OOP with PHP Yesterday, I read in the archives somewhere that in PHP, class attributes are all static attributes (class variables), not instance variables. (Figures, I can't find it again, so I can't provide a link.) In other words, the attributes apply to every single instance of an object. This contradicts my limited experience with OOP in PHP, but I hoped someone could confirm this before I write up this giant class I'm working on. Thanks! Erik Erik Price Web Developer Temp Media Lab, H.H. Brown [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php