one more question , how to pivot a table in controller?
change this table
a b
1 2
3 4
5 6
to
c d f
1 3 5
2 4 6
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send ema
how to pivot a table ?
change
a b
1 2
3 4
5 6
to
c d e
1 3 5
2 4 6
?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe
really helps me a lot , thx
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTE
If you have your models setup correctly:
hasAndBelongsToMany if the user can be a part of many groups, or
User belongsTo Group | Group hasMany User if they only belong to one.
Then in the method your controller:
class GroupsController extends AppController
{
function index()
{
In your controller get the data and pivot it, then send it to the
view.
Shawn
On Aug 14, 8:49 am, Wimg <[EMAIL PROTECTED]> wrote:
> The problem is like this, i have a database as below:
>
> user_id , group_id
>
> 1 1
> 2 1
> 3 2
> 4 2
>
> i wan
The problem is like this, i have a database as below:
user_id , group_id
1 1
2 1
3 2
4 2
i wanna display users in the same group as a row in a table
group1 group2
12
34
i was thinking that I get group_id first, then
Post the problem and lets see if we can help you out :-)
On Aug 14, 10:29 am, Wimg <[EMAIL PROTECTED]> wrote:
> correct,, i just have a problem do not how to solve
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ca
correct,, i just have a problem do not how to solve
On Aug 14, 5:01 pm, Langdon Stevenson <[EMAIL PROTECTED]>
wrote:
> > Can I access database or execute some sql inside views ?
>
> Given that this is PHP, yes I dare say you can.
>
> The point though is that you shouldn't. Perform your queries
> Can I access database or execute some sql inside views ?
Given that this is PHP, yes I dare say you can.
The point though is that you shouldn't. Perform your queries and
business logic in your Controller and Model. Pass the resulting data to
your view to render. That is all that your vie