Hi again.
i have a email system which uses a db. when a new email is sent (enterd into the database) the feild "new" defults as 1. Now in my inbox i have it so that it displays the number 1 from the db next to the email. I would like to know to things.
How can i make it so that if when the email is read it changes the 1 to a 0.
Can instead of the number 1 or 0 now beig displayed in the inbox a checkbox be ticked or an image displayed for each number so the user can tell if they have read the email or not.
Hope this makes sence :s
Thanks
Eric
how could i do this??
Moderator: General Moderators
- ericburnard
- Forum Contributor
- Posts: 104
- Joined: Wed Jun 15, 2005 5:11 pm
- Location: Chesterfield, UK
- ericburnard
- Forum Contributor
- Posts: 104
- Joined: Wed Jun 15, 2005 5:11 pm
- Location: Chesterfield, UK
i no the if function is really really simple but i cnt get it to work. i have a loop with echos in to display the latest mail but i cant seem to get it to work with the if function in:S what am i doing wrong?
i guessed i would have to put it in an echo function but that dosnt seen to want to work either.
Any ideas??
Thanks again
Eric
Code: Select all
<?
include('http://eric.madashatters.com/header.inc');
?>
<?php
// Connecting, selecting database
mysql_connect('localhost', '*******', '*****')
or die('Could not connect: ' . mysql_error());
mysql_select_db('madashat_mail') or die('Could not select database');
echo "<BR>";
$offset = $_GET['offset'];
if($offset == "") $offset = 0;
$max = $offset + 10;
$username = mysql_real_escape_string($_GET['user']);
$query = "SELECT * FROM pm WHERE user='$username' order by id desc";
$result = mysql_query($query) or die(mysql_error());
$rows = mysql_numrows($result);
if($max > $rows) $max = $rows;
echo "<center><u><b>Inbox</u></b><br><BR><a href='http://eric.madashatters.com/sendmail.php?user=".$username."'>New Email Message</a> | <a href='http://eric.madashatters.com/sentmail.php?userm=".$username."'>Sent</a><br><table align='middle' cellpadding='5' style='border: dotted 1px'>
<tr>
<td><div class='white'>New</td>
<td><div class='white'>Date</td>
<td><div class='white'>Subject</td>
<td><div class='white'>Sender</td>
<td><div class='white'>Delete</td>";
for($i=$offset;$i<$max;$i++){
$subject = mysql_result($result,$i,"subject");
$new = mysql_result($result,$i,"new");
$message = mysql_result($result,$i,"message");
$date = mysql_result($result,$i,"date");
$sender = mysql_result($result,$i,"sender");
$id = mysql_result($result,$i,"id");
echo "<tr style='border: dotted 1px'>";
echo "<td><div class='white'>";
if ($new = 1)
echo 'New';
echo "</td>";
echo "<td><div class='white'>$date</td>";
echo "<td><div class='white'><a href='http://eric.madashatters.com/readmail.php?user=".$user."&mail=".$id."'>$subject</a></td>";
echo "<td><div class='white'>$sender</td>";
echo "<td></td>";
echo "</tr>";
}
?>
</table> <BR><BR>
<?
include('http://eric.madashatters.com/footer.inc');
?>Any ideas??
Thanks again
Eric
- ericburnard
- Forum Contributor
- Posts: 104
- Joined: Wed Jun 15, 2005 5:11 pm
- Location: Chesterfield, UK
- ericburnard
- Forum Contributor
- Posts: 104
- Joined: Wed Jun 15, 2005 5:11 pm
- Location: Chesterfield, UK
thats good then lol cos i cudnt remember putting them intheda wrote:I was just saying you dont echo mysql functions.
Oh, I'm curious what does "<you><b>Inbox</you>" <- what do the you tags do? Edit: Oh yeah, dumb filter changes the underline tag <_<
i still cant seem to get it to work. any pointers at all ??
eric