Home » phpHtmlLib » Widgets » Fatal error: Call to a member function on a non-object in C:\Programme\Apache Group\Apache2\htdocs\p
| Fatal error: Call to a member function on a non-object in C:\Programme\Apache Group\Apache2\htdocs\p |
Thu, 13 February 2003 05:34  |
schdefan Messages: 44 Registered: February 2003 |
Member |
 From: 212.82.103
|
|
Thank you for changing my state of age.
Starting the following script returns error message
Fatal error: Call to a member function on a non-object in C:\Programme\Apache Group\Apache2\htdocs\p
<?php
/**
* This example illustrates the use of the
* DataList object classes. This object
* can show a list of data from any data source
* and have any GUI layout and provide the
* features of:
* searching, sorting, paging of the data.
*
* This page shows the Data coming from 2 different
* types of DB objects. One from a PEAR::DB object,
* and another from a ADODB object.
*
* $Id: widget6.php,v 1.7 2002/11/22 21:51:08 hemna Exp $
*
* @author Walter A. Boring IV <waboring@buildabetterweb.com>
* @package phpHtmlLib
* @subpackage widget-examples
* @version 2.0
*
*/
/**
* Include the phphtmllib libraries
*
*/
include_once("includes.inc");
include_once("db_defines.inc");
include_once($phphtmllib."/widgets/data_list/includes.i nc");
require_once("adodb/adodb.inc.php" );
include_once($phphtmllib."/widgets/data_list/ADODBSQLDa taListSource.inc");
/**
* This is an example that shows how to use a PEAR db object
* as the source for the data to show.
*
* @author Walter A. Boring IV <waboring@buildabetterweb.com>
* @package phpHtmlLib
* @subpackage widget-examples
* @version 2.0
*/
class adodbmssqllist extends DefaultGUIDataList {
//change the # of rows to display to 20 from 10
var $_default_rows_per_page = 20;
/**
* This function is called automatically by
* the DataList constructor. It must be
* extended by the child class to actually
* set the DataListSource object.
*
*
*/
function get_data_source() {
//build the ADODB object and connect
//to the database.
$db = &ADONewConnection('mssql'); # create a connection
$db->Connect(DB_HOSTNAME,DB_USERNAME,DB_PASSWORD,DB_NAME) ;
//create the DataListSource object
//and pass in the PEAR DB object
$source = new ADODBSQLDataListSource($db);
//set the DataListSource for this DataList
//Every DataList needs a Source for it's data.
$this->set_data_source( $source );
//set the prefix for all the internal query string
//variables. You really only need to change this
//if you have more then 1 DataList object per page.
$this->set_global_prefix("adodb_");
}
/**
* This method is used to setup the options
* for the DataList object's display.
* Which columns to show, their respective
* source column name, width, etc. etc.
*
* The constructor automatically calls
* this function.
*
*/
function user_setup() {
//add the columns in the display that you want to view.
//The API is :
//Title, width, DB column name, field SORTABLE?, field SEARCHABLE?, align
$this->add_header_item("idperson", "100", "idperson", SORTABLE,
SEARCHABLE, "left");
$this->add_header_item("person", "100", "person", SORTABLE,
SEARCHABLE,"center");
// $this->add_header_item("Time", "200", "time", SORTABLE,
// NOT_SEARCHABLE,"center");
$columns = "*";
$tables = "person p";
$where_clause = "1";
$this->_datasource->setup_db_options($columns, $tables, $where_clause);
}
/**
* This is the basic function for letting us
* do a mapping between the column name in
* the header, to the value found in the DataListSource.
*
* NOTE: this function is can be overridden
* so that you can return whatever you want for
* any given column.
*
* @param array - $row_data - the entire data for the row
* @param string - $col_name - the name of the column header
* for this row to render.
* @return mixed - either a HTMLTag object, or raw text.
*/
function build_column_item($row_data, $col_name) {
switch ($col_name) {
case "Time":
$dt = $row_data["time"];
$yr=strval(substr($dt,0,4));
$mo=strval(substr($dt,4,2));
$da=strval(substr($dt,6,2));
$hr=strval(substr($dt,8,2));
$mi=strval(substr($dt,10,2));
$obj = date("m/d/Y h:i A", mktime ($hr,$mi,0,$mo,$da,$yr));
break;
default:
$obj = DefaultGUIDataList::build_column_item($row_data, $col_name);
break;
}
return $obj;
}
}
//create the page object
$page = new HTMLPageClass("phpHtmlLib Widgets - DataList Example",
XHTML_TRANSITIONAL);
//enable output debugging.
$page->set_text_debug( $_GET["debug"] );
//add the css
$page->add_head_css( new DefaultGUIDataListCSS );
//build the ADODB list using the same exact table in the DB
//and sort by version by default
$adodblist = new adodbmssqllist("ADODB::MSSQL List", 600, "version", TRUE);
$page->add( $adodblist );
print $page->render();
?>
|
|
| | |
| Re: Fatal error: Call to a member function on a non-object in C:\Programme\Apache Group\Apache2\htdo |
Fri, 14 February 2003 10:22   |
|
a couple things you can try. Make sure the db object is connecting to the DB, and u can also turn on debugging for the adodb object.
so do this
function get_data_source() {
//build the ADODB object and connect
//to the database.
$db = &ADONewConnection('mssql'); # create a connection
//TURN ON ADODB DEBUGGING
$db->debug=TRUE;
$db->Connect(DB_HOSTNAME,DB_USERNAME,DB_PASSWORD,DB_NAME) ;
...
|
|
|
| Fatal error: Call to a member function on a non-object |
Tue, 29 November 2005 07:42   |
ierokomos Messages: 1 Registered: November 2005 |
Newbie |
 From: host-24-149-180-138.patmedia.net
|
|
I am getting this following error ..
Fatal error: Call to a member function render() on a non-object in /usr/local/apache2/htdocs/phphtmllib/XMLTagClass.inc on line 425
with the use of the below script (apache2 and php 5.1.1)
any suggestions are greatly appreciated.
============
<?php
/**
* This example illustrates the use of the
* VerticalCSSNavTable widget.
*
*
* $Id: widget4.php,v 1.5.2.1 2005/05/12 01:24:02 hemna Exp $
*
* @author Walter A. Boring IV <waboring@newsblob.com>
* @package phpHtmlLib
* @subpackage widget-examples
* @version 2.0
*
*/
/**
* Include the phphtmllib libraries
*
*/
include_once("includes.inc");
//create the page object
$page = new HTMLPageClass("phpHtmlLib Widgets - VerticalCSSNavTable",
XHTML_TRANSITIONAL);
//enable output debugging.
if (isset($_GET['debug'])) {
$page->set_text_debug( TRUE );
}
//add the css
$page->add_css_link( "/css/defaulttheme.php" );
//create the VerticalCSSNavTable Object
//create the widget with
//Title of 'VerticalCSSNavTable' and
//subtitle of 'Widget'
//overall width of 400 pixels ( u can use % as well )
$cssnavtable = new VerticalCSSNavTable("VerticalCSSNavTable", "Widget", 400);
$cssnavtable->add("#", "Some Link", "This is title text");
$cssnavtable->add("#", "Another");
$cssnavtable->add("#", "Another", "This is title text");
$page->add( $cssnavtable );
print $page->render();
?>
|
|
| | | |
Goto Forum:
Current Time: Wed Jun 19 03:07:43 PDT 2013
Total time taken to generate the page: 1.02988 seconds
|