php - Create a Multidimensional Array with Codeigniter and MySQL -


I am developing an internal mailing system using codeigniter, just like the Gmail Mailing System, leaving the answer.

I want to show both messages and current messages in a message (if mail is answered) such as Gmail

Let's say that I have a table of threads in which there are many relationships with table messages.

Thread

thread_id | Msg_id | Sender_ID | Sender_fell | Receiver_id | Receiver_fell | Status

Message

ID | Topic | Body |

The above tables work fine to show inbox and mail Are sent.

But now I want to show the message sent with the original message. (Like Gmail) / p>

For this, I am planning to change the structure of the thread table (by adding two more field answers- 0 or 1, answer_id)

select < Code> subject , body , cdate , sender_id , username ash email, lbs_mails . ID AS mail_ id, status , sender_role , thread_ID FROM ( lbs_mails ) JOIN lbs_threads ON lbs_threads . msg_id = lbs_mails . ID join lbs_auth on LBS_th . uid = lbs_threads . sender_id and role = lbs_thread.Sender_Leal WHERE lbs_threads . receiver_role = '3' and lbs_threads . receiver_ID = '1'

An effective way to recover data will be to create a multi-dimensional array such as:

  $ inbox = Array ([subject] = & gt; test mail [body] => reply test mail [cdat] => 2014-04-22 17:56:42 [sender_id] => 2 [email] = > Email@email.com [mail_id] => 7 [Position] = & gt; 1 [Sender_Local] = & gt; 2 [answer_id] => Array ([topic] => Test Mail Answer [body] => Answer to test mail [cdt] => 2014-04-22 17:56:42))   

How do I get it? I can help, anyone can help me!

I will be the easiest option to call a database for the message retrieving related data To do the second database call, just look at the data and mix it in an array.

Comments

Popular posts from this blog

c# - LINQ to Entities does not recognize the method 'Int32 IndexOf(System.String, System.StringComparison)' method -

python - Writing Greek in matplotlib labels, titles -

Pygame memory leak with transform.flip -