How to display messages from mysql database in rows?

Discussion in 'PHP' started by tin2mon, Sep 21, 2010.

  1. #1
    hi friends,
    How can i display messages from mysql databse in each rows with delete button and reply button in PHP.
    Please help me...
    no codes working properly,
    thanks in advance.
     
    tin2mon, Sep 21, 2010 IP
  2. axelay

    axelay Peon

    Messages:
    54
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Well it all depends...
    There is no magic code that will do that for you, however if your DB is properly designed, you will have an index on each row and the field will be called something like id.

    Then the code should look like:
    foreach ($rows as $row)
    {
      echo $row['name'] . ' <a href="./myscript.php?id=' . $row['id'] . '&action=delete">delete</a> <a href="./myscript.php?id=' . $row['id'] . '&action=reply">reply</a>';
    }
    Code (markup):
    But again, it is hard to make sure this will apply to your site...

    aXe
     
    axelay, Sep 21, 2010 IP