Jump to content

how to make a email inbox like's guestbook? data retrieve from mysql


zgkhoo

Recommended Posts

Maybe u could give some details of the script instead of just asking and asking. What u mean with email inbox like guestbook? Are making an email client or smth? I'll try to answer your questions generally:

 

Data retrive from mysql which display in multiple pages:

I guess u know how to connect and send queries to a db. For multiple pages use the LIMIT command of mysql. There are a lot of pagination tutorials and thats pretty easy.

 

Display the topic as link which redirects to the full message:

echo the topic column of your db between <a> html tags and make the href smth like fullview.php?id=xx where xx is the actual id of that topic. In fullview.php strip the id with get and make a query to show that message.

 

Delete tick checkbox:

U may use just simple button, when it is pressed it make the url smth like mypage.php?delete=xx where xx is the id of the message to be deleted.

 

There's nothing complex in this thing, but u need some basic php/mysql knowledge.

Link to comment
Share on other sites

  • 2 years later...

I am not sure am not sure if you have found your answer or not. Here’s how I am doing it and if you found a better way, please let me know so I can make mine better. =0)

 

Let’s make some assumptions first... First, I have a table with user’s information, their names, nickname, sign up date and etc. Next, I have a second table that holds user’s encrypted passwords and last time logged in. This table is linked to the Users Info Table with User Info’s primary key.

Next we are going to need an “Inbox” table. My inbox table keeps track of where the messages come from, where it goes, what’s its title, what are the contents and when it was sent. I also have a status and a type column.

 

TABLE: Inbox
<primary> msgID | <int> CLFrom | <int> CLTo | <text> CLSubject | <text> CLBody | <text> CLdate | <Char(1)> msgStatus | <Char(1)> msgType

 

Now we need a sent box. Because if we have the same inbox and sent box table, then when a recipient deletes a message it will be deleted from sender’s sent box. So we want to keep track of sent and received separately.

 

TABLE: Sent
<primary> msgID | <int> CLFrom | <int> CLTo | <text> CLSubject | <text> CLBody | <text> CLdate | <Char(1)> msgType

 

Notice that this table does not have a status. In a more complicated scenario we can have a status table in Sent table and confirm that the message was “Received”. We can do that just by toggling the status column for a sent message when for example the message is clicked and read at the recipient side.

Next thing we need is a table to keep track of the responses to the inbox or sent messages. The way this works, we show the user a list of main conversations (unlike Exchange servers or IMAPI or POP3 which shows each message and it marks it as a reply to a certain message). We just want the user to pick a main topic and upon clicking “View Related” for example, we retrieve the list of responses to that message.

TABLE: Response
<primary> respID | <int>CLFrom | <text>CLSubject | <text>CLDate | <text>CLbody | <Char(1)> CLType | <int> msgID

 

Note that in this table there is only a From which has the userkey for the user who sent the message. We can retrieve the other party information by looking at the main context at the inbox table.

 

Things to consider is that you will need to nl2br the text captured for message body to preserve the \r\n and so on. Minor details =0)

So this is putting it all together:

 

INBOX: 		STATUS    DATE     FROM    SUBJECT     DATE   
RESPONSE:		STATUS	   DATE	FROM SUBJECT DATE
RESPONSE:		STATUS	   DATE	FROM SUBJECT DATE
RESPONSE:		STATUS	   DATE	FROM SUBJECT DATE
INBOX: 		STATUS    DATE     FROM    SUBJECT     DATE   
RESPONSE:		STATUS	   DATE	FROM SUBJECT DATE
RESPONSE:		STATUS	   DATE	FROM SUBJECT DATE

 

Possibilities are infinite, add a CC or a BCC or save "userkey:userkey:userkey" in the FROM column to send a message to multiple people and so on.  8)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.