Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Sobota, 28. november 2026
O nás
Magazín
Otvorený softvér
CVS
Služby
Index  »  Projekty  »  phpMyEdit  »  Fórum  »  Insert two columns values with one input

phpMyEdit Configuration     Insert two columns values with one input
Odoslať novú tému   Odpovedať na tému    
 
lysergic     Založený: 27.02.2010   Príspevky: 2  
Príspevok Zaslal: 2010-02-27 01:48
Návrat hore  Odpovedať s citátom     

Hi all, I'm really a noob and I cannot make something You will find easy.

My need: I want to insert in table "races" two (or more) values retrieved from "events" table:

table: events
id
event_name
location
...


table: races
race_id
event_id
race_name

race_name is selected from table1 because race_name = event_name, and with a drop down I'm ok

but I need to insert also the id of the event (events.id) in races.event_id automatically, without choosing or writing it

My code for the race_name:


Kód:
$opts['fdd']['name'] = array(
  'name'     => 'Name',
  'select'   => 'T',
  'maxlen'   => 30,
  'sort'     => true,
'values' => array(
'table' => 'frl_dbem_events',
'column' => 'event_name',
'description' => 'event_name')
);


Thanks for helping an ugly noob :(

 
paddywwoof     Založený: 25.02.2010   Príspevky: 7  
Príspevok Zaslal: 2010-03-02 09:43
Návrat hore  Odpovedať s citátom     

You should only add the key field (event.id) to the race table. You can display other information from the event table using this when you display or edit the race table.

 
lysergic     Založený: 27.02.2010   Príspevky: 2  
Príspevok Zaslal: 2010-03-02 10:01
Návrat hore  Odpovedať s citátom     

Hi, thanks for the help.

Can you give me another help? I would like to show in the dropdown: event_id - event_name

How can I do it? I don't know the syntax of concat function (i iI have to use it)

 
paddywwoof     Založený: 25.02.2010   Príspevky: 7  
Príspevok Zaslal: 2010-03-02 12:18
Návrat hore  Odpovedať s citátom     

I think I would do something like this. The crucial thing is the 'column' points to the key of the other table and 'description' is an array with 'columns' and 'divs' arrays

Kód:
$opts['fdd']['event_id'] = array(
  'name'     => 'Event',
  'select'   => 'T',
  'maxlen'   => 30,
  'sort'     => true,
  'values' => array(
  'table' => 'frl_dbem_events',
  'column' => 'id',
  'description' => array (
    'columns' => array('id', 'event_name'),
    'divs' => array(' - ', '')
  }
);


 
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