0

I want to fetch data from a table let's say  table "activities". 

Uid |​​​​​​​day|activity|time|remarks

1.  Mon. Act1.   3pm.    Good

2.  Mon. Act1.   5pm.    Bad

1.  Tue. Act2.   12am.   Bad

1.  Tue. Act5.   1am.    Bad

1.  Thur Act8.   9pm.    Good 

2.  Wed. Act4.  7am.    Good

Now assuming I want to fetch all the data that is related to user Id 1 and display them in another table (Uid 1).  

​Which is 4 rows according to the table, how do I go about it using select query?   Thanks!!!

I tried something like this but it displays just one row

    <?php

    $uid = $_SESSION['login'];

    $sql2 = "SELECT * FROM Activities WHERE uid=? ORDER BY Uid LIMIT 6";
    $stmt2 = $connection->prepare($sql2); 
    $stmt2->bind_param('i', $Uid);
    $stmt2->execute();
    $result2 = $stmt2->get_result();
    $row2 = $result2->fetch_assoc();

    //now am stuck here
     ?>

now trying to fetch and display those datas (That's 4 rows according to the table sample) for only Uid 1 in these simple format... Say an HTML table.

Thanks in advance!!!

Dellyz
  • 11
  • 2

1 Answers1

0

just print the variable $row2,if you get the 4 rows then access each record by position value such as $row2[0]

Anand
  • 5
  • 1