how can print the most recent statuse of a user among multiple statuses

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Raju B
    New Member
    • Aug 2010
    • 11

    how can print the most recent statuse of a user among multiple statuses

    hi ...
    in my site all users can update their status(presentl y doing work etc.) multiple times as they wish. Now i have to print only one most recent status of each user once on home page. how can i do this in php.please send me the code for this..
    it's urgent for me..
    thanks in advance..
    Raju B
  • Atli
    Recognized Expert Expert
    • Nov 2006
    • 5062

    #2
    Hey.

    This is not a code-on-demand service. We are happy to help you solve problems you are facing, or answer questions you have while writing your code, but we will not write it for you.

    Post what you have tried, why/how it failed, error messages, excepted and actual output of the code. Any information we can use to help solve the problem.

    Comment

    • Raju B
      New Member
      • Aug 2010
      • 11

      #3
      hi Atli,
      Thanks for your reply actually i written code for getting all statuses that are stored in database.now iam not getting any idea to modify the code for fetching single status of each user.iam new to php.please modify the below code. iam not demanding anything from you
      Code:
      <?php 
      session_start();
      $_SESSION['username'];
      $db=mysql_connect("localhost","root","root");
      mysql_select_db("statusdesk",$db);
      $query = "SELECT users.imagepath,users.username, statuses.status,statuses.date FROM users,statuses WHERE users.username=statuses.username ORDER BY id DESC ";
      	 
      $result = mysql_query($query) or die(mysql_error());
      
      
      // Print out the contents of each row into a table 
      while($row = mysql_fetch_array($result)){
      	
      	Print "<img src=".$row['imagepath'].">"."</img>"."<a href="."statuses.php"."?"."username"."=".$row['username']. ">" .$row['username'] . "</a>".$row['status'].$row['date']."</br>"; 
          
      }
      ?>

      Comment

      • muralikalpana
        New Member
        • Jul 2010
        • 5

        #4
        select the row using userid

        Comment

        Working...