Topshed
Založený: 04.11.2007
Príspevky: 20
Zaslal: 2007-11-05 14:52
Návrat hore
Odpovedať s citátom
|
I am Totally new to PHP and I am having problems joining 2 fields in my output
ie:-
$opts['fdd']['mm_build'] = array(
'name' => 'Build',
'select' => 'T',
'maxlen' => 3,
'sort' => true
);
$opts['fdd']['yy_build'] = array(
'name' => 'Date',
'select' => 'T',
'maxlen' => 4,
'sort' => true
);
I want to joint them to show 'Nov-2007' in one column
Please help
Roy..
|
michal
Založený: 17.06.2003
Príspevky: 537
Bydlisko: Slovakia
Zaslal: 2007-11-07 22:19
Návrat hore
Odpovedať s citátom
|
see sql option
something like
'sql|LFV'=>'concat(col1,'-',col2)'
bevare of premissions (this should not happen in AC modes)
|
Topshed
Založený: 04.11.2007
Príspevky: 20
Zaslal: 2007-11-08 07:31
Návrat hore
Odpovedať s citátom
|
Thank you for the reply Michael,
I cannot get it to work, but as I said I am very new to this stuff and a bit old to bre learning a new language(67)
I created a extra filed inb the table
test varchar(30)
but test in the rrsults shows a column of 0's
I have got this far see below but I don't even know if I am close to getting it correct
$opts['fdd']['allclass'] = array(
'name' => 'Class',
'select' => 'T',
'maxlen' => 5,
'sort' => false,
);
$opts['fdd']['aclas2'] = array(
'name' => 'Part',
'select' => 'T',
'maxlen' => 25,
'sort' => false
);
$opts['fdd']['test'] = array(
'name' => 'Test',
'select' => 'T',
'maxlen' => 30,
'sort' => false,
'sql|LFV'=>'concat(allclass,'-',aclas2)'
);
any help would be appreaciated
Thanks
Roy..
|
michal
Založený: 17.06.2003
Príspevky: 537
Bydlisko: Slovakia
Zaslal: 2007-11-08 08:42
Návrat hore
Odpovedať s citátom
|
this should not run (i'm surprised it does not show php nor sql errors)
instead of
'concat(allclass,'-',aclas2)'
it shlould be
"concat(allclass,'-',aclas2)"
(quote's type)
sorry for misleading
|
Topshed
Založený: 04.11.2007
Príspevky: 20
Zaslal: 2007-11-08 09:55
Návrat hore
Odpovedať s citátom
|
Fantastic that did the job, and I learned something in the process, however I still need some assistance.
How to SELECT both fields, without them showing on the screen so I can display the result in test.
But using the first field(allclass) as a drop down to select the class
Putting the drop down on test of course produces nothing ..
Sorry to be a pain
Regards
Roy....
|
michal
Založený: 17.06.2003
Príspevky: 537
Bydlisko: Slovakia
Zaslal: 2007-11-08 09:59
Návrat hore
Odpovedať s citátom
|
aclas2 should have option=>'AC'
allclass should have that sql
no column test
|
Topshed
Založený: 04.11.2007
Príspevky: 20
Zaslal: 2007-11-08 10:28
Návrat hore
Odpovedať s citátom
|
Thank you for your patience,
The code now as is :-
$opts['fdd']['allclass'] = array(
'name' => 'Class',
'select' => 'D',
'maxlen' => 5,
'sort' => false,
'sql|LFV'=>"concat(allclass,' ',aclas2)"
);
$opts['fdd']['aclas2'] = array(
'name' => 'Part',
'select' => 'F',
'options' => 'AC',
'maxlen' => 25,
'sort' => false
);
Fails because the Current Query: concat(allclass,' ',aclas2) = 'B12'
is not true when they are concatenated.
I also tried switching them around so that aclass2
comes first but that changed nothing
I believe I see the logic of all this, but working out how to solve it is another matter
Regards
Roy..
|
|
Odoslať novú tému
Odpovedať na tému
|