Hi all,
I am using cakePHP 1.26. I got a simple Table with some data in my localhost Database:
user_id | message | receiver_id
-----------------------------
1 | helloworld | 12
2 | hi there | 12
Let say the system now received the $userid from a user.
The user only got the user ID. He wants to search all the message received by a specific Receiver
Here is my code for the case mentioned above:
$receiverID=$this->user->read('receiver_id', $userid); // find the receiver ID
$data=$this->user->findByreceiver_id($receiverID); //then retrieve data by the receiver ID
debug($data);
The code isn't neat and looks clumsy.
I am not sure if there is any best way to do it in this case.
Please advise.