php-windows Digest 18 Nov 2003 09:16:14 -0000 Issue 2005
Topics (messages 22123 through 22127):
Re: PHP CODE ERROR?
22123 by: Bob Harris
22124 by: Piotr Pluciennik
22125 by: Rocco CAstoro
22126 by: Piotr Pluciennik
Re: MS-SQL / FreeTDS - charsets ? - solved
22127 by: Lars V. Nielsen
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
Could it be related to the fact the none of the functions being called as
"$test->func_call()" are actually defined as being a member of your class
"Table"?
Thus addrow() might exist but $test->addrow() does not.
"Rocco Castoro" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Can Anyone tell my why this error is produced:
>
> Fatal error: Call to undefined function: addrow() in C:\Program
Files\Apache
> Group\Apache2\htdocs\Hour8-7MainExample.php on line 63
>
> From this code:
>
> <?php
>
> // Defining the Class's Properties -------
> class Table
> {
> var $table_array = array();
> var $headers = array();
> var $cols;
> }
>
> //Creating a Constructor ------
> function Table( $headers )
> {
> $this->headers = $headers;
> $this->cols = count ( $headers );
> }
>
> //The addROw() Method ------
> function addRow( $row )
> {
> if ( count ($row) != $this->cols )
> return false;
> array_push($this->table_array, $row);
> return true;
> }
>
> //The addRowAssocArray() Method
> function addRowAssocArray( $row_assoc )
> {
> $row = array();
> foreach ( $this->headers as $header )
> {
> if ( ! isset( $row_assoc[$header] ))
> $row_assoc[$header] = "";
> $row[] = $row_assoc[$header];
> }
> array_push($this->table_array, $row);
> return true;
> }
>
> //
> function output()
> {
> print "<pre>";
> foreach ( $this->headers as $header )
> print "<B>$header</B> ";
> print "\n";
> foreach ( $this->table_array as $y )
> {
> foreach ( $y as $xcell )
> print "$xcell ";
> print "\n";
> }
> print "</pre>";
> }
>
> $test = new table( array("a", "b", "c") );
> $test->addRow( array(1,2,3) );
> $test->addRow( array(4,5,6) );
> $test->addRowAssocArray (array ( b=>0, a=>6, c=>3 ) );
> $test->output();
> ?>
>
> Thanks Alot guys your MUCHos HHelpos
--- End Message ---
--- Begin Message ---
You've not defined any method for your class.
Read comments with ****** below.
HTH
Piotr
// Defining the Class's Properties -------
class Table
{
var $table_array = array();
var $headers = array();
var $cols;
} ********* here you've ended your class definition
********* so below it's not a constructor...
//Creating a Constructor ------
function Table( $headers )
{
$this->headers = $headers;
$this->cols = count ( $headers );
}
********* and addrow isn't also a member function of
your class
//The addROw() Method ------
function addRow( $row )
{
if ( count ($row) != $this->cols )
return false;
array_push($this->table_array, $row);
return true;
}
__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree
--- End Message ---
--- Begin Message ---
NO, it is all because I exited the Class Properties before I defined all the
class functions, the first } shuld be the last }
"Bob Harris" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Could it be related to the fact the none of the functions being called as
> "$test->func_call()" are actually defined as being a member of your class
> "Table"?
>
> Thus addrow() might exist but $test->addrow() does not.
>
>
> "Rocco Castoro" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Can Anyone tell my why this error is produced:
> >
> > Fatal error: Call to undefined function: addrow() in C:\Program
> Files\Apache
> > Group\Apache2\htdocs\Hour8-7MainExample.php on line 63
> >
> > From this code:
> >
> > <?php
> >
> > // Defining the Class's Properties -------
> > class Table
> > {
> > var $table_array = array();
> > var $headers = array();
> > var $cols;
> > }
> >
> > //Creating a Constructor ------
> > function Table( $headers )
> > {
> > $this->headers = $headers;
> > $this->cols = count ( $headers );
> > }
> >
> > //The addROw() Method ------
> > function addRow( $row )
> > {
> > if ( count ($row) != $this->cols )
> > return false;
> > array_push($this->table_array, $row);
> > return true;
> > }
> >
> > //The addRowAssocArray() Method
> > function addRowAssocArray( $row_assoc )
> > {
> > $row = array();
> > foreach ( $this->headers as $header )
> > {
> > if ( ! isset( $row_assoc[$header] ))
> > $row_assoc[$header] = "";
> > $row[] = $row_assoc[$header];
> > }
> > array_push($this->table_array, $row);
> > return true;
> > }
> >
> > //
> > function output()
> > {
> > print "<pre>";
> > foreach ( $this->headers as $header )
> > print "<B>$header</B> ";
> > print "\n";
> > foreach ( $this->table_array as $y )
> > {
> > foreach ( $y as $xcell )
> > print "$xcell ";
> > print "\n";
> > }
> > print "</pre>";
> > }
> >
> > $test = new table( array("a", "b", "c") );
> > $test->addRow( array(1,2,3) );
> > $test->addRow( array(4,5,6) );
> > $test->addRowAssocArray (array ( b=>0, a=>6, c=>3 ) );
> > $test->output();
> > ?>
> >
> > Thanks Alot guys your MUCHos HHelpos
--- End Message ---
--- Begin Message ---
This is exactly what I've told you in my last post... :-)
Piotr
Rocco CAstoro wrote:
> NO, it is all because I exited the Class Properties before I defined all the
> class functions, the first } shuld be the last }
> "Bob Harris" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Could it be related to the fact the none of the functions being called as
> > "$test->func_call()" are actually defined as being a member of your class
> > "Table"?
> >
> > Thus addrow() might exist but $test->addrow() does not.
> >
> >
> > "Rocco Castoro" <[EMAIL PROTECTED]> wrote in message
> > news:[EMAIL PROTECTED]
> > > Can Anyone tell my why this error is produced:
> > >
> > > Fatal error: Call to undefined function: addrow() in C:\Program
> > Files\Apache
> > > Group\Apache2\htdocs\Hour8-7MainExample.php on line 63
> > >
> > > From this code:
> > >
> > > <?php
> > >
> > > // Defining the Class's Properties -------
> > > class Table
> > > {
> > > var $table_array = array();
> > > var $headers = array();
> > > var $cols;
> > > }
> > >
> > > //Creating a Constructor ------
> > > function Table( $headers )
> > > {
> > > $this->headers = $headers;
> > > $this->cols = count ( $headers );
> > > }
> > >
> > > //The addROw() Method ------
> > > function addRow( $row )
> > > {
> > > if ( count ($row) != $this->cols )
> > > return false;
> > > array_push($this->table_array, $row);
> > > return true;
> > > }
> > >
> > > //The addRowAssocArray() Method
> > > function addRowAssocArray( $row_assoc )
> > > {
> > > $row = array();
> > > foreach ( $this->headers as $header )
> > > {
> > > if ( ! isset( $row_assoc[$header] ))
> > > $row_assoc[$header] = "";
> > > $row[] = $row_assoc[$header];
> > > }
> > > array_push($this->table_array, $row);
> > > return true;
> > > }
> > >
> > > //
> > > function output()
> > > {
> > > print "<pre>";
> > > foreach ( $this->headers as $header )
> > > print "<B>$header</B> ";
> > > print "\n";
> > > foreach ( $this->table_array as $y )
> > > {
> > > foreach ( $y as $xcell )
> > > print "$xcell ";
> > > print "\n";
> > > }
> > > print "</pre>";
> > > }
> > >
> > > $test = new table( array("a", "b", "c") );
> > > $test->addRow( array(1,2,3) );
> > > $test->addRow( array(4,5,6) );
> > > $test->addRowAssocArray (array ( b=>0, a=>6, c=>3 ) );
> > > $test->output();
> > > ?>
> > >
> > > Thanks Alot guys your MUCHos HHelpos
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
My problem has been solved, with the offline help of some NG members.
The solution requires that one turns off the "Automatically convert ANSI to
OEM?" setting in the "Client Network Utility".
Apparently this setting is used by the PHP extension, and apparently it's a
user/login dependent setup too. Both items puzzles me, but it seems to be
that way.
--
Best regards
Lars V. Nielsen
--- End Message ---