[solved]Notice: Undefined property error
Posted: Tue May 22, 2007 4:01 am
ALrighty I've been scratching my brain for nearly an hour on this ridiculous error.
The error I get is as follows:
Notice: Undefined property: sql_query_value::$get_field_name in S:\Web_Pages\Object_Library\Input_Set\sql_query.php on line 24
For some reason I can call this get_field_value method of an sql_query_value object from the first class; but when I parse this object to the sql_query class, it won't call the method then???
The error I get is as follows:
Notice: Undefined property: sql_query_value::$get_field_name in S:\Web_Pages\Object_Library\Input_Set\sql_query.php on line 24
For some reason I can call this get_field_value method of an sql_query_value object from the first class; but when I parse this object to the sql_query class, it won't call the method then???
Code: Select all
$field_one = new sql_query_value("region_name", "WOOOOHOOOO");
$field_two = new sql_query_value("state", "SA");
$fields=array($field_one, $field_two);
echo "field_one=".$fields[1]->get_field_value( ); //THIS LINE WORKS FINE
$region_info_query = new sql_query("regions", $fields);
class sql_query_value
{
private $field_name, //Stores the namem of the column in the database with which the field_value will be stored in
$field_value; //Stores the value (or data) which is to be inserted into the database
//Constructor - creates a new sql_query_value object
public function __construct($field_name, $field_value)
{
$this->field_name=$field_name;
$this->field_value=$field_value;
}
//Returns the field name of this object
public function get_field_name( )
{
return $this->field_name;
}
//Returns the field value of this object
public function get_field_value( )
{
return $this->field_value;
}
}
class sql_query
{
private $table_name, //stores the name of theh table which the data will be entered into
$sql_query_values; //stores an array of sql_query_values
public function __construct($table_name, $sql_query_values)
{
$this->table_name=$table_name;
$this->sql_query_values=$sql_query_values;
//LINE 24 echo "tester".$sql_query_values[0]->get_field_value;
}
}