Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Streda, 11. november 2026
O nás
Magazín
Otvorený softvér
CVS
Služby
Index  »  Projekty  »  phpMyEdit  »  Fórum  »  How to use the value of a field for another field

phpMyEdit General     How to use the value of a field for another field
Odoslať novú tému   Odpovedať na tému    
 
franciscohm     Založený: 08.05.2008   Príspevky: 33  
Príspevok Zaslal: 2008-07-22 19:57
Návrat hore  Odpovedať s citátom     

Hi there,

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

Kód:
$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     Založený: 09.04.2008   Príspevky: 20  
Príspevok Zaslal: 2008-07-23 16:42
Návrat hore  Odpovedať s citátom     

franciscohm Napísal:
Hi there,

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

Kód:
$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     Založený: 08.05.2008   Príspevky: 33  
Príspevok Zaslal: 2008-08-06 13:49
Návrat hore  Odpovedať s citátom     

Thanks very much. I am going to try it.

F

 
franciscohm     Založený: 08.05.2008   Príspevky: 33  
Príspevok Zaslal: 2009-01-24 18:59
Návrat hore  Odpovedať s citátom     

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

Kód:
$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:

Kód:
'name' => 'Date of Filenumber: '.$result_3,


 
franciscohm     Založený: 08.05.2008   Príspevky: 33  
Príspevok Zaslal: 2009-01-24 19:08
Návrat hore  Odpovedať s citátom     

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!

 
Odoslať novú tému   Odpovedať na tému    

Copyright © 2002-2006 Platon Group
Stránka používa redakčný systém Metafox
Na začiatok · Odkazový formulár · Prihláška
Upozorniť na chybu na PLATON.SK webstránke · Podmienky použitia · Ochrana osobných údajov