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  »  fetch interval data from other table

phpMyEdit General     fetch interval data from other table
Odoslať novú tému   Odpovedať na tému    
 
Barbapapa     Založený: 21.07.2009   Príspevky: 2  
Príspevok Zaslal: 2009-07-21 23:21
Návrat hore  Odpovedať s citátom     

Hello there :)

I am a new phpmyedit user and i try to learn php-mysql.
Until a few days ago, phpmyedit worked fine, but now i need a number (dagen) from an other table in the same database to do a DATE_ADD.
As you can see, in the code below, i am struggling with php, mysql and phpmyedit :)

I have been trying for days, what am i doing wrong?

Kód:
$opts['fdd']['dagen'] = array(
   'table'   => 'adres',
   'column'  => 'dagen',
   'sql|L'     => 'SELECT dagen FROM `adres` WHERE 1 LIMIT 0, 30'
);

$opts['fdd']['Datum_ver'] = array(
'name'    => 'Datum verlopen',
'select'  => 'T',
'options' => 'FL',
'sort'    =>  true,
'sql|LF'  => 'if((CURDATE() < DATE_ADD(Datum, interval dagen DAY)) OR (CURDATE() < DATE_ADD(HDatum, interval dagen DAY)), Datum_ver, "Verlopen")'
);


MySQL error:

Kód:
MySQL error 1064

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT dagen FROM `adres` WHERE 1 LIMIT 0, 30 AS qf5 FROM factuur AS PMEtable0 L' at line 1

phpMyEdit error: invalid SQL query

SELECT PMEtable0.id AS qf0,CONCAT(PMEjoin1.Naam,", ",PMEjoin1.tav) AS qf1,PMEtable0.Naam AS qf1_idx,PMEtable0.Datum AS qf2,PMEtable0.HDatum AS qf3,PMEtable0.VDatum AS qf4,SELECT dagen FROM `adres` WHERE 1 LIMIT 0, 30 AS qf5 FROM factuur AS PMEtable0 LEFT OUTER JOIN simpelfactuunl_testdb.klant AS PMEjoin1 ON (PMEjoin1.Naam = PMEtable0.Naam) ORDER BY PMEtable0.id DESC LIMIT 0,20


Thanks

 
doug     Založený: 10.02.2003   Príspevky: 1013   Bydlisko: Denver, Colorado (USA)
Príspevok Zaslal: 2009-07-22 16:11
Návrat hore  Odpovedať s citátom     

See the application of virtual (dummy) fields, and the "next to last" entry at the following link.

http://opensource.platon.sk/forum/projects/viewtopic.php?t=961&highlight=virtual+date+add

 
Barbapapa     Založený: 21.07.2009   Príspevky: 2  
Príspevok Zaslal: 2009-07-22 22:56
Návrat hore  Odpovedať s citátom     

Thanks doug,
I have seen this thread before, but the virtual field did not work.

This is what i tried:
Kód:
$opts['fdd']['vir_field'] = array(
  'name'     => 'virtual field',
  'options' => 'L',
  'select'   => 'T',
  'nowrap' => true,
  'sort'     => true,
     'values'     => array(
     'table'      => 'adres',
     'column'     => 'dagen',
        'description'=> array(
        'columns'    => array('dagen, aid'),
        'divs'       => array(', '),
        'orderby'    => "dagen"
)));


This is the error:
Kód:
MySQL error 1054
Unknown column 'PMEtable0.vir_field' in 'on clause'


I double checked table and column names. aid is the ID

Greetings.

 
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