thefollower Posted August 23, 2007 Share Posted August 23, 2007 Im stuck as this is beyond my realm of thought so i duno what to do. I had the idea of a "letterbox" type thing... whereby your allowed 3 mails to be sent to you then you have "reached max" now i can create a max and stop more than 3 occuring no problem. But what i now have are: $Message1 $Message2 $Message3 which obtain the 3 messages from my DB table Then i echo these. But say some one deletes message 2. I want message one to drop down so that any new message will be the top one in the list. My method maybe a bit complex cos of the way i have coded the current html. I created 3 seperate divs like this : <div id="bv_" style="position:absolute;left:375px;top:468px;width:224px;height:128px;z-index:19" align="center"> <font style="font-size:13px" color="#000000" face="Arial"> Test </font></div> <div id="bv_" style="position:absolute;left:381px;top:630px;width:224px;height:128px;z-index:20" align="center"> <font style="font-size:13px" color="#000000" face="Arial"> Test2 </font></div> <div id="bv_" style="position:absolute;left:388px;top:794px;width:224px;height:128px;z-index:21" align="center"> <font style="font-size:13px" color="#000000" face="Arial">Test3 </font></div> where i have "TEST" i will replace with <?= $Message1 ?>/<?= $Message2 ?>/<?= $Message3 ?> once i have done all the connect and query stuff. But mainly im stuck in terms of how to make them drop down in the list when one is removed. So the latest one will be above the others. I have time stamps on the message so i can order them youngest first but how would you echo it to do that? Is there a simpler way than i have done it ? Quote Link to comment Share on other sites More sharing options...
Jessica Posted August 23, 2007 Share Posted August 23, 2007 add ORDER BY timestamp_column_name_here DESC to your sql Quote Link to comment Share on other sites More sharing options...
thefollower Posted August 23, 2007 Author Share Posted August 23, 2007 ok but say ther were 3 rows (3 messages) how do you get it to do : row 1 = $message1 row 2 = $message2 etc ? Quote Link to comment Share on other sites More sharing options...
trq Posted August 23, 2007 Share Posted August 23, 2007 Easier to store them in an array. eg; <?php // run query and place resultant resource within $result. $messages = array(); while ($row = mysql_fetch_assoc($result)) { $messages[] = $row['message']; } ?> Now you can use $message[0], $message[1] and $message[2]. Quote Link to comment Share on other sites More sharing options...
thefollower Posted August 23, 2007 Author Share Posted August 23, 2007 so what happens if i make a script to delete message[2] how does the array sort them then if say a new message comes in .. will i be assigned to message[2] or will it become [ 0 ] and the rest pushed up ? Quote Link to comment Share on other sites More sharing options...
thefollower Posted August 24, 2007 Author Share Posted August 24, 2007 bump Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.