$deine_ids = $_SESSION['userid'];
$meineid= $deine_ids;
$a = 0;
$abfrage = "SELECT * FROM mail LEFT JOIN users ON mail.m_von = users.id WHERE m_id IN ( SELECT MAX(m_id) FROM mail WHERE (m_an = $meineid) AND (m_status = 0 ) GROUP BY m_von) ORDER BY m_zeit DESC LIMIT 300";
//$abfrage = "SELECT * FROM message LEFT JOIN user ON message.von = user.id WHERE (an = $deineid) AND (status = 1 ) GROUP BY id ORDER BY m_id DESC LIMIT 10000";
$no =0;
$ergebnis = mysql_query($abfrage);
while($row = mysql_fetch_object($ergebnis))
{
$a++;
$no = 1;
$timestamp_m = $row->m_zeit;
$username_m = $row->username;
$id_m = $row->id;
$bild_m = $row->avatar;
$message_m = $row->m_text;
$status_m = $row->m_status;
$m_id = $row->m_id;
$uhrzeit_m = date("d.m.y - H:i",$timestamp_m);
$sql = mysql_query("SELECT * FROM mail WHERE (m_an = $meineid) AND (m_status = 0 ) AND (m_von = $id_m)");
$anzahlneui = mysql_num_rows($sql);
?>