Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Wednesday, November 11, 2026
About Us
Magazine
Open Source
CVS
Services
Index  »  Projects  »  phpMyEdit  »  Forum  »  How to use the value of a field for another field

phpMyEdit General     How to use the value of a field for another field
Post new topic   Reply to topic    
 
franciscohm     Joined: 08 May 2008   Posts: 33  
Post Posted: 2008-07-22 19:57
Back to top  Reply with quote     

Hi there,

while configuring a field (Field 2), I need as a parameter the value of a different field (Field 1):

Code:
$opts['fdd']['field2'] = array(
  'default'    => '',
  'input'      => '',
  'name'       => 'Field 2',
  'options'    => 'ACPVDX',
  'select'     => 'D',
  'values'   => array(
      'table' => 'my_table',
      'column' => 'id',
      'orderby' => 'id',
      'filters'     => "$filter"
  ), 
  'sort'       => true
);


"$filter" must display a value equal to "file_number=F-XXXX", being "F-XXXX" the value of a field called "field1". How can I insert that value into my expression? (so that I get F-0034, F-6542, etc. etc. depending on the case).

In other words, is there a variable or an expression that stores the value of "field1"? (so that I can use it for whatever purpose).

Thanks very much in advance for any help
Francisco

 
Icehawg     Joined: 09 Apr 2008   Posts: 20  
Post Posted: 2008-07-23 16:42
Back to top  Reply with quote     

franciscohm wrote:
Hi there,

while configuring a field (Field 2), I need as a parameter the value of a different field (Field 1):

Code:
$opts['fdd']['field2'] = array(
  'default'    => '',
  'input'      => '',
  'name'       => 'Field 2',
  'options'    => 'ACPVDX',
  'select'     => 'D',
  'values'   => array(
      'table' => 'my_table',
      'column' => 'id',
      'orderby' => 'id',
      'filters'     => "$filter"
  ), 
  'sort'       => true
);


"$filter" must display a value equal to "file_number=F-XXXX", being "F-XXXX" the value of a field called "field1". How can I insert that value into my expression? (so that I get F-0034, F-6542, etc. etc. depending on the case).

In other words, is there a variable or an expression that stores the value of "field1"? (so that I can use it for whatever purpose).

Thanks very much in advance for any help
Francisco


'filters' => 'file_number=PMEtable0.field1'

 
franciscohm     Joined: 08 May 2008   Posts: 33  
Post Posted: 2008-08-06 13:49
Back to top  Reply with quote     

Thanks very much. I am going to try it.

F

 
franciscohm     Joined: 08 May 2008   Posts: 33  
Post Posted: 2009-01-24 18:59
Back to top  Reply with quote     

I got a solution. I guess it is not the most efficient one, but at least it works for my case:

Code:
$recordid = @$_REQUEST['PME_sys_rec'];
$query_filenumber = 'SELECT file_number FROM a_system_offers_lmr WHERE id='.$recordid;
$result_1 = mysql_query($query_filenumber) or die ("No se ha podido ejecutar al consulta sobre la Base de Datos.");
$result_2 = mysql_fetch_array($result_1);
$result_3=$result_2[file_number];


So now that I have the value of the field "file_name" (of the current record) stored in $result_3, I can use it almost everywhere. For instance in the description of a another field:

Code:
'name' => 'Date of Filenumber: '.$result_3,


 
franciscohm     Joined: 08 May 2008   Posts: 33  
Post Posted: 2009-01-24 19:08
Back to top  Reply with quote     

There is a little "error" in the code i posted before: The update of the description is delayed. I mean, you need to save twice to see the results.

In my case it is not important, but take it into account for other cases!

 
Post new topic   Reply to topic    

Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top · Feedback form · Application form
Report bug on PLATON.SK website · Terms of use · Privacy policy