Hi I have two table one called user and the other call msg.
In msg i have from_id, to_id and read
I am waiting to get the username of the from_id and it on the users page so the user knows who sent the message. at the moment it is only showing the users ID.
I tryed the following but it did not work.
If any one can help that would be great.Code:<?php $sql = 'SELECT * FROM `msg`'; $query = mysql_query($sql) or die(mysql_error()); while($row = mysql_fetch_assoc($query)) { $from = $row[from_id]; $to_id = $row[to_id]; $msgid = $row[msgid]; $user = 'SELECT * FROM `users` WHERE `id` ='.$from; $userquery = mysql_query($user); while($usermsg = mysql_fetch_array($userquery)) { $msg_from_image = $usermsg[username]; ?> From | reply? | Delete <form> <?php echo $msg_from_image;?> <input id="delete" value="0" name="to" size="10" Type="hidden"> <input class="button" onClick="ajaxFunction();" value="Enter" type="button" > </form> <?php } } ?>



Reply With Quote

Bookmarks