What's new

Welcome to xCrud Community - Data Management and extended PHP CRUD

Join us now to get access to all our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, and so, so much more. It's also quick and totally free, so what are you waiting for?

Columns names of custom queries ?

ben74

New member
Joined
Dec 13, 2021
Messages
20
Reaction score
5
Points
3
Location
France
Hello,

I can't find a solution to this and I've searched hours, it must be hidden somewhere in the source code.

Anyway here is the problem : I'm using a custom query similar to :

Select blabla as col1, doudou as col2 from ...

Then I expected to be able to use the names col1 and col2 as regular table column names, i.e. be able to write:

$xcrud->column_width('col1','90px');

But this doesnt work...

I've also tried with the database name in front of the field (so $xcrud->column_width('dbname.col1','90px'); ) but still no chance...

Any idea?

Thanks a lot!
 

DaDo

Administrator
Staff member
Joined
Dec 1, 2021
Messages
108
Reaction score
23
Points
18
Hello,

I can't find a solution to this and I've searched hours, it must be hidden somewhere in the source code.

Anyway here is the problem : I'm using a custom query similar to :

Select blabla as col1, doudou as col2 from ...

Then I expected to be able to use the names col1 and col2 as regular table column names, i.e. be able to write:

$xcrud->column_width('col1','90px');

But this doesnt work...

I've also tried with the database name in front of the field (so $xcrud->column_width('dbname.col1','90px'); ) but still no chance...

Any idea?

Thanks a lot!
You have to use subselect

$xcrud->subselect('field_name','Select blabla as col1');
$xcrud->subselect('field_name2','Select doudou as col2');
 
Top Bottom