stekenno Posted June 18, 2012 Share Posted June 18, 2012 Hello I have browsed this site many times looking for answers and it's helped alot but I couldn't find an answer for this problem. I want messages to be displayed in the mail box to a certain amount say 25 and when a new mail is received the 26th one is then deleted. $mysql1 = mysql_query("SELECT * FROM `inbox` WHERE `to`='$username' AND `read` = '1' ORDER by id DESC LIMIT 25"); $num_rows =mysql_num_rows($mysql1); if ($num_rows == "0"){ echo "<center>No Messages</center>"; }else{ while($get = mysql_fetch_object($mysql1)){ mysql_query(DELETE * FROM `inbox` WHERE `to`='$username' AND `read` = '1' NOT IN (SELECT * FROM `inbox` WHERE `to`='$username' AND `read` = 1 ORDER by id DESC LIMIT 2)); THIS Part is the broken bit. $t++; $n++; echo " <table width=90% border=0 align=center cellspacing=0 class=messagetable> Link to comment https://forums.phpfreaks.com/topic/264386-help-mysql_query/ Share on other sites More sharing options...
Pikachu2000 Posted June 18, 2012 Share Posted June 18, 2012 What does echo mysql_error() show you? Link to comment https://forums.phpfreaks.com/topic/264386-help-mysql_query/#findComment-1354898 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.