Search the Community
Showing results for tags 'inboox'.
-
hello i did a php message system where it get data from sql and it extracts the message that the person wrote you, but is separated into conversations so in the inbox i want it to show only the last message shown, witch it works ONLY for the first person that sends you a message not for the other persons that send you messages so i made a data base where conversation_hash is unique and you it has ids in string separated by a "," <?php $b = mysql_query("SELECT * FROM conversations"); while($a = mysql_fetch_array($B)){ $hash = $a['conversation_hash']; $ids = $a['ids']; $ids = explode(",", $ids); if(array_search($id, $ids) == true){ $ids = array_filter($ids, 'strlen'); foreach($ids as $o){ if($o !== $id){ print_r($ids); echo $o; $y = mysql_query("SELECT * FROM messages WHERE conversation_hash='$hash' AND from_id='$o' ORDER BY message_id DESC "); $t = mysql_fetch_array($y); ?> <div class="message"> <center> <table width="600"> <tr> <td width="75" rowspan="2"> <img src="/elitequorum/<?php echo $t['image_location']; ?>" height="75" width="75" /> </td> <td height="39"> </td> <td height="" rowspan="2"> <table height="75"> <tr> <td width="450" style="vertical-align:middle;" height="55"> <?php echo $t['message']; ?> </td> </tr> <tr> <td style="text-align:right; vertical-align:bottom;" height="5"> <?php echo $t['date']; ?> </td> </tr> </table> </td> </tr> <tr> <td width="75" height="34"> <?php echo $t['username']; ?> </td> </tr> </table> </center> </div> <?php } } } } ?> to do some testing if the information is getting where is suppost to i did some print_r(); and the information does go but it doesnt go in the SQL as a loop, i dont get any PHP/SQL error but the script is not working correctly, this is what i get: ---------------------------------------------------------------------- image1| Message1 | date2 | ----------------------------------------- broken(image2)| empty(message2) | empty(date2) | ---------------------------------------------------------------------------------------- And this is what im suppos to get: ---------------------------------------------------------------------- image1| Message1 | date2 | ----------------------------------------- image2| message2 | date2 |