Re: classes and return values

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jason Gerfen wrote:
I am attempting to work up a class and because I am unfamiliar with some of the code flow I am only able to get a return value of 'object'. How can I pull the data out of a class?

which data? It doesn't seem as if anyone knows what your trying to do.
(try to explain it again)

there is a difference between class and object - it's quite fundamental
to the whole OO concept.

<?

// the following is a [php4] class
class Test {
	var $foo = "bar";
	function getData() { return $this->foo; }
}

// $t is an object (assuming an error doesn't occur when instantiating it)
$t = new Test;

// this is an echo statement that outputs the return val from a method call
echo $t->getData(),"\n";


Any help, or pointers on what I am doing wrong is appreciated.

class myAuth
{
var $user;
var $pass;
var $lvl;
var $id;
  function login( $user, $pass ) {
require 'templates/auth.tmplte.php';
global $defined, $error_message;
 if( ( empty( $user ) ) || ( empty( $pass ) ) ) {
  if( $_SESSION['count']++ >= 1 ) {
$errors = "<img src=\"images/error.jpg\">&nbsp;&nbsp;<b>You need to provide a user name and password!</b><br><br>";
    }
   $data = new myAuthTmplte();
   $data->auth_template( 1, NULL, NULL, NULL, $errors );
   logs( $error_message['str_chk'] );
 }
}
}


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux