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
https://forums.phpfreaks.com/topic/231191-email-system/
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
https://forums.phpfreaks.com/topic/231191-email-system/#findComment-1189959
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
https://forums.phpfreaks.com/topic/231191-email-system/#findComment-1189964
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.