Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Streda, 25. november 2026
O nás
Magazín
Otvorený softvér
CVS
Služby
Index  »  Projekty  »  phpMyEdit  »  Fórum  »  Resolved: error: fields with same name (table&lookup)

phpMyEdit General     Resolved: error: fields with same name (table&lookup)
Odoslať novú tému   Odpovedať na tému    
 
mgirard     Založený: 10.02.2005   Príspevky: 2  
Príspevok Zaslal: 2005-02-10 20:56
Návrat hore  Odpovedať s citátom     

Hello all!!

I just started using phpMyEdit this week and it work Great!!! But now I got a little "bug" that I can't really undertand... perhaps one of you will me able to point me where I misunderstood/maked an error/ else lol.


Kód:
There is my error message :

MySQL error 1052

Column: 'start_date' in field list is ambiguous

phpMyEdit error: invalid SQL query

SELECT PMEtable0.id AS qf0,PMEtable0.schedule_id AS qf1,PMEjoin2.contract_number AS qf2,PMEtable0.lease_contract_id AS qf2_idx,concat(substring(start_date, 1, 4), "-", substring(start_date, 5, 2), "-", substring(start_date, 7, 2), " ", substring(start_date, 9, 2), ":", substring(start_date, 11, 2), ":", substring(start_date, 13, 2) ) AS qf3,concat(substring(end_date, 1, 4), "-", substring(end_date, 5, 2), "-", substring(end_date, 7, 2), " ", substring(end_date, 9, 2), ":", substring(end_date, 11, 2), ":", substring(end_date, 13, 2) ) AS qf4 FROM lease_schedules AS PMEtable0 LEFT OUTER JOIN inventory.lease_contracts AS PMEjoin2 ON PMEjoin2.id = PMEtable0.lease_contract_id ORDER BY PMEtable0.schedule_id,PMEtable0.id LIMIT 0,154.897 miliseconds


There is my table and the lookup table creation script :

Kód:
CREATE TABLE `lease_schedules` (
  `id` smallint(5) unsigned NOT NULL auto_increment,
  `schedule_id` varchar(20) NOT NULL default '',
  `lease_contract_id` smallint(5) unsigned NOT NULL default '0',
  `start_date` timestamp(14) NOT NULL,
  `end_date` timestamp(14) NOT NULL,
  PRIMARY KEY  (`id`),
  KEY `lease_contract_id` (`lease_contract_id`)
) TYPE=MyISAM COMMENT='Lease Schedules'



# Table "lease_contracts" DDL

CREATE TABLE `lease_contracts` (
  `id` smallint(5) unsigned NOT NULL auto_increment,
  `contract_number` varchar(20) NOT NULL default '',
  `financial_ownership_id` smallint(5) unsigned NOT NULL default '0',
  `start_date` timestamp(14) NOT NULL,
  `end_date` timestamp(14) NOT NULL,
  PRIMARY KEY  (`id`),
  KEY `financial_ownership_id` (`financial_ownership_id`)
) TYPE=MyISAM COMMENT='Lease Contracts'



And there is what I want to do in my php script. I don't understand I used exactly the same syntax in somes other pages and it work ok...

Kód:
$opts['fdd']['id'] = array(
  'name'     => 'ID',
  'select'   => 'T',
  'options'  => '', // auto increment
  'maxlen'   => 5,
  'sort'     => true
);
$opts['fdd']['schedule_id'] = array(
  'name'     => 'Schedule',
  'select'   => 'T',
  'maxlen'   => 20,
  'required' => true,
  'sort'     => true
);

$opts['fdd']['lease_contract_id'] = array(
  'name'     => 'Lease contract',
  'select'   => 'T',
  'maxlen'   => 5,
  'required' => true,
  'sort'     => true
);
$opts['fdd']['lease_contract_id']['values']['table'] = 'lease_contracts';
$opts['fdd']['lease_contract_id']['values']['column'] = 'id';
$opts['fdd']['lease_contract_id']['values']['description'] = 'contract_number';
$opts['fdd']['lease_contract_id']['values2'] = array(''=>'');
$opts['fdd']['lease_contract_id']['sqlw'] = 'if(\'$val\' = \'\',NULL,\'$val\')';

$opts['fdd']['start_date'] = array(
  'name'     => 'Start date',
  'select'   => 'T',
  'maxlen'   => 19,
  'required' => true,
  'sort'     => true,
  'calendar' => true,
   'sql' => 'concat(substring(start_date, 1, 4), "-", substring(start_date, 5, 2), "-", substring(start_date, 7, 2), " ", substring(start_date, 9, 2), ":", substring(start_date, 11, 2), ":", substring(start_date, 13, 2) )'
);


$opts['fdd']['end_date'] = array(
  'name'     => 'End date',
  'select'   => 'T',
  'maxlen'   => 19,
  'required' => true,
  'sort'     => true,
  'calendar' => true,
   'sql' => 'concat(substring(end_date, 1, 4), "-", substring(end_date, 5, 2), "-", substring(end_date, 7, 2), " ", substring(end_date, 9, 2), ":", substring(end_date, 11, 2), ":", substring(end_date, 13, 2) )'
);



Thx for helping me guys!


Naposledy upravil mgirard dňa 2005-02-10 21:38, celkom upravené 3 krát

 
mgirard     Založený: 10.02.2005   Príspevky: 2  
Príspevok Zaslal: 2005-02-10 21:03
Návrat hore  Odpovedať s citátom     

SOLUTION :

Kód:
$opts['fdd']['start_date'] = array(
  'name'     => 'Start date',
  'select'   => 'T',
  'maxlen'   => 19,
  'required' => true,
  'sort'     => true,
  'calendar' => true,
   'sql' => 'concat(substring(PMEtable0.start_date, 1, 4), "-", substring(PMEtable0.start_date, 5, 2), "-", substring(PMEtable0.start_date, 7, 2), " ", substring(PMEtable0.start_date, 9, 2), ":", substring(PMEtable0.start_date, 11, 2), ":", substring(PMEtable0.start_date, 13, 2) )'
);


 
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