Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Sobota, 21. november 2026
O nás
Magazín
Otvorený softvér
CVS
Služby
Index  »  Projekty  »  phpMyEdit  »  Fórum  »  Retrieve previous value for current field?

phpMyEdit Configuration     Retrieve previous value for current field?
Odoslať novú tému   Odpovedať na tému    
 
Icehawg     Založený: 09.04.2008   Príspevky: 20  
Príspevok Zaslal: 2008-04-21 18:37
Návrat hore  Odpovedať s citátom     

*reposting with a clearer title and without the confusing first post*

When using the changelog what I would like to do is grab the contents of the previous field for use in the current field so that I can show something more relevant then just "id #" (rowkey). Yet I am unable to get the desired result using $opts['cgi']['persist']. Maybe I misunderstand the usage...or there is another way to do this without writing a separate trigger?

Code:
Kód:

$opts['fdd']['tbl'] = array{
  'name'   => 'Table',
  'select' => 'T',
  'maxlen' => 255,
  'sort'   => true
};
$opts['fdd']['rowkey'] = array{
  'name'   => 'Rowkey',
  'select' => 'T',
  'maxlen' => 255,
  'sort'   => true,
  'values' => array{
              'table' =>  $opts['fdd']['tbl']['val'],
              'column' => 'uid' ,
              'description' => 'name'
              }
};

$opts['fdd']['tbl']['val'] This is the sticky bit that I am having the problem with...how do I get the value from the previous $FDD for use as a table look up in the next $FDD?

Is it possible?

I tried searching for "dynamic"(and variations) here on the forums and scoured through all the complex join examples but can't see a way. I think I am missing something rather obvious....

Thanks in advance.

NOTE : all my tables have the same first two fields UID and NAME. UID is an autoincrement whereas NAME is a 100 character text field so no matter what table I am accessing those two fields have the required data.


Naposledy upravil Icehawg dňa 2008-05-08 01:33, celkom upravené 2 krát

 
Icehawg     Založený: 09.04.2008   Príspevky: 20  
Príspevok Zaslal: 2008-04-29 13:24
Návrat hore  Odpovedať s citátom     

Howdy,

Before I abandon this idea as "impossible" as I haven't been able to make it work after a week now, does anyone have any thoughts/suggestions/ideas on how I can get the previous field value for the current field?

Thanks.

 
Icehawg     Založený: 09.04.2008   Príspevky: 20  
Príspevok Zaslal: 2008-05-08 01:40
Návrat hore  Odpovedať s citátom     

Criminy, I am so close but I just can't push past some stupid dead spot. I figured out how to populate my next field with the previous field however I don't want to populate with that value, I want to use that value as a table name for a lookup.

Kód:

   $opts['fdd']['tbl'] = array(
     'name'     => 'Table',
     'select'   => 'T',
     'options'  => 'LVF',
     'sort'     => true,
     'sql'        => 'UPPER(REPLACE(tbl, "gcs__character_", ""))'
   );
   $opts['fdd']['rowkey'] = array(
     'name'     =>   'Field in Table',
     'select'   => 'T',
     'options'  => 'VF',
     'sort'     => true,
     'sql|V'    => 'tbl', //THIS POPULATES FIELD WITH DESIRED DATA...SO IT IS FLOATING AROUND HERE SOMEWHERE
     'values'   => array(
              'table' => $PME_data_tbl, // THIS VARIABLE! HOW DO I GET AT IT?!!??! Damned brain...be more smarterer.
              'column' => 'uid',
              'description' => 'name'
              ),
   );


I must have tried 200 different attempts at getting the value for the previous field as a table for a lookup on the next field and can't grab it.

Before I go insane, or spend another 8 hours reading every post on this forum...anyone have an idea? (Yes I have spent 8 full hours studying these forums looking for an answer)

 
Icehawg     Založený: 09.04.2008   Príspevky: 20  
Príspevok Zaslal: 2008-05-18 16:52
Návrat hore  Odpovedať s citátom     

Just because I hate to see forum questions abandoned with no answer I will post this final reply.

Nope. Couldn't resolve this issue and have given up after a month of fighting.

 
genio     Založený: 15.09.2008   Príspevky: 2  
Príspevok Zaslal: 2008-09-15 16:56
Návrat hore  Odpovedať s citátom     

don't give up, i think I fix it...

I had the same problem, changelog would give 0 in col field with an autoincrement value.

Seems like that the changelog function which inserts the colum id when inserting a new row sends 0 when the id is set to autoinrement. This in theory is not wrong as on the form if you set an ID field as autoincrement, it will be 0, and the DB interprets that to be changed to the next available number in a id key field.

However, for the purpose of the change log, this is incorrect.

You currently use;

$query = sprintf('INSERT INTO %s'
.' (updated, user, host, operation, tab, rowkey, col, oldval, newval)'
.' VALUES (NOW(), "%s", "%s", "insert", "%s", "%s", "", "", "%s")',
$this->logtable, addslashes($this->get_server_var('REMOTE_USER')),
addslashes($this->get_server_var('REMOTE_ADDR')), addslashes($this->tb),
addslashes($key_col_val), addslashes(serialize($newvals)));

but in fact should be

$query = sprintf('INSERT INTO %s'
.' (updated, user, host, operation, tab, rowkey, col, oldval, newval)'
.' VALUES (NOW(), "%s", "%s", "insert", "%s", "%s", "", "", "%s")',
$this->logtable, addslashes($this->get_server_var('REMOTE_USER')),
addslashes($this->get_server_var('REMOTE_ADDR')), addslashes($this->tb),
addslashes($this->rec), addslashes(serialize($newvals)));

as this guarantees that the correct field is used, either if in uatoincrement mode, or if the user has assigned itself the id

 
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