View Single Post
Old 06-13-2010, 07:00 PM   #2 (permalink)
Village Idiot
Wizard
Top Contributor 
 
Village Idiot's Avatar
 
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
Village Idiot is on a distinguished road
Default

Quote:
Originally Posted by pipesportugal View Post
PHP Code:
// class name is record
// number of records is 1.
// vector_fields is an array with the fieldnames in the table 
// The field names are like: code_customer, name_customer, and so on.

//*************************************
while ($row2 mysql_fetch_array($this->result_sql)) {
  for(
$j0$j<count($this->vector_fields); $j++) {
     
$firstpartstring $this->vector_fields[$j];
     
$stringfieldname 'scr_'.$firstpartstring;
     
$this->$stringfieldname $row2['$firstpartstring'];
  } 
// END of for
// END of while

//*************************************
// From the main program I want to retrieve the name of the customer with:
//  $customer = new record();
//  $customer_invoice = $customer->scr_name_customer; 
I am geting the following error:
Catchable fatal error: Object of class registo could not be converted to string in /home/vnhdpwxq/public_html/classes/classe_ler_registos.php on line 68

I believe it is because of the sentence:

PHP Code:
$this->$stringfieldname 
The program is not expecting the "$" on the stringfieldname variable.
What I really need is to make a $this->scr_name_customer.

Can someone help me overpass this problem?

I have completely run out of ideas.

Thanks in advance,
PP
It should be
PHP Code:
$this->stringfieldname 
. I don't understand what you mean by "What I really need is to make a $this->scr_name_customer."
__________________

Village Idiot is offline  
Reply With Quote