Forums

Need help with Models

m.schuurman 02 Mar, 2015
Hello,

Can someone help me with the following isue.
I want to create a list of messages dependig on the relationship provided bij CB.
For example the logged in users has a relation with several users, this relationship is found at jos_comprofiler_members.
The messages are saved at jos_messages with a tabel user_id.
So i want to create a list of messages from all related users.
I have searched the forum but couldn't find a good sample, i tryed several things with Models but with no good result.

Can anyone point me in the good direction.

Thanks in advance,

Greetz Marcel.
GreyHead 03 Mar, 2015
Hi Marcel,

Sorry, I don't know CB well enough to help. You may get more specific help on their site.

This is really a MySQL question on how to build the right database query. I suggest that you experiment in PHPMyAdmin to work out what you need then we can tell you how to build that in ChronoConnectivity (it's usually quite simple once you have the right query. (You might also be able to build a MySQL view and use that for the listing.)

Bob
m.schuurman 03 Mar, 2015
Hi Bob,
Thanks for your reply,
It's not really a CB issue, i only use a table from CB. What i want is a list of messages from the users where the logged on user has a relation with.(found in the CB table)
So first i need to have a list of users from the CB table where, the result is an array off userid's, then i want to search a list of messages where the owner is one of the users in the array.

Unfortunately i'm not a SQL expert so building a query is a bit of a problem for me.

Thanks,
Marcel.
m.schuurman 03 Mar, 2015
Update,
I managed to create a usefull list so most of the things work for now, i really didn'n know what i was doing but it looks okay.
I have only one little question, When you use de conditionbox you can filter by the return array("field_name" => "XYZ"); what i need now is a filter that checks if a value is NOT <> instead of =>.
I tryed <> <=> <= etc but it seems not to work,

Thanks,

Marcel
GreyHead 03 Mar, 2015
Hi Marcel,

Yes that's more or less what I understood you needed.

Bob
m.schuurman 03 Mar, 2015
Hi Bob,
Don't you have an idea of the right syntax?

Thanks,

Marcel
GreyHead 03 Mar, 2015
Hi Marcel,

As I said, I don't know how the CB tables are set up. It's probably a simple MySQL join but I'd be guessing if I suggested anything without doing the research.

Bob
This topic is locked and no more replies can be posted.