Jump to content

Email system


alamnaryab

Recommended Posts

I have database table EMAIL[e_id,receiver_email,sender_email,email_Subject,date_time,Text_body]

 

i have displayed sender_email,Email_subject,Date_time in html table

by using

select sender_email,Email_subject,Date_time from email where receiver_email=$current _user

i need to open email_body by clicking the sender_email

problem is that how can i get value of first cell of table in the same row by clicking any other column

or if you have alternative

as yahoo displayes all emails received in inbox

by clicking any sender it opens that specific email

 

Link to comment
Share on other sites

Add the id field to the list of fields that are SELECTed in the query, then use that value in the url string or $_POST array when accessing the script that displays the individual message.

 

SELECT id, sender_email, Email_subject, Date_time FROM email WHERE receiver_email=$current _user

Link to comment
Share on other sites

Hi alamnaryab,

 

I use something similar for the messaging on my website.

When a user clicks on the sender or subject I redirect to the page which displays the message and send the message id in the URL.

 

$message_id = $messages_row['id'];
echo "<a href='message.php?id=$message_id'>";
echo "From: " . $messages_row['sender'];
echo "Subject: " . $messages_row['subject'] . "<br />";
echo "</a>";

 

Then on the page that displays the message i use $_GET to retrieve the message id from the URL.

 

$message_id = $_GET['id'];
$messages_query = mysql_query("SELECT * FROM messages WHERE id='$message_id' AND recipient='$username'");
$messages_row = mysql_fetch_assoc($messages_query);

 

Hope it helps

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.