| | |
php -> classes problem
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Nov 2008
Posts: 5
Reputation:
Solved Threads: 0
hi guys. i am writing a class for registering data and i am having a problem calling functions and vars from other classes.
here's a class diagram of where everything is called-
http://img376.imageshack.us/img376/19/classesdm8.png
i am in forms, and i am having difficulty getting vars from site, using my functions in postgredb and vars from user.
i can get data from form easily.
but when i try getting data from site i get an fatal saying site is not a member of form, ($this->site->var) so, how do i call data from a parent class?
solved
solved it- used a public $p; then set $form->p = $this, and then when calling parent date - $this->p->var...
here's a class diagram of where everything is called-
http://img376.imageshack.us/img376/19/classesdm8.png
i am in forms, and i am having difficulty getting vars from site, using my functions in postgredb and vars from user.
i can get data from form easily.
PHP Syntax (Toggle Plain Text)
$this->var
but when i try getting data from site i get an fatal saying site is not a member of form, ($this->site->var) so, how do i call data from a parent class?
solved
solved it- used a public $p; then set $form->p = $this, and then when calling parent date - $this->p->var...
Last edited by asciid; Nov 21st, 2008 at 3:31 pm.
example:
thats one way to do it. there are more.
PHP Syntax (Toggle Plain Text)
class test { var $var; function __construct() { $this->var = 'something'; } function testing() { echo 'This is the parent function'; } } class test2 { var par; var var2; function __construct( &$par ) { $this->par = $par; } } $test = new test(); $test2 = new test2( $test ); $test2->par->testing() //will echo 'this is the parent class';
thats one way to do it. there are more.
![]() |
Similar Threads
- I need a great web designer and proffesional PHP Coder ~ 10k project (Web Development Job Offers)
- PHP and JAVA vs .NET (IT Professionals' Lounge)
- Opinions? javascript/php/etc and programming standards (JavaScript / DHTML / AJAX)
- Problem receiving result from Microsoft Soap toolkit server service using Nusoap clie (RSS, Web Services and SOAP)
- pop up problem please help!!! (Viruses, Spyware and other Nasties)
- Invision Furl problem (PHP)
- WINFIX problem, Help! (Viruses, Spyware and other Nasties)
- what is the problem (C++)
- Problem Unsetting Variables? (PHP)
Other Threads in the PHP Forum
- Previous Thread: Using simple php redirect script but need to pull information from mysql instead
- Next Thread: Php Hurdle
| Thread Tools | Search this Thread |
.htaccess ajax apache api array beginner binary broken buttons cakephp checkbox class cms code cron curl database date directory display download dynamic ebooks echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla limit link login loop mail mediawiki menu mlm mod_rewrite multiple mysql number oop paypal pdf php phpincludeissue phpmyadmin problem query radio random recursion regex remote script search server sessions sms soap source sp space speed sql subdomain syntax system table tag tutorial update upload url validation validator variable vbulletin video web websphere white xml youtube






