Almari
-
Posts
7 -
Joined
-
Last visited
Posts posted by Almari
-
-
-
1. It does match the one I clicked but displays always the 1st record on 'newdisplay.php'
2. There's no further code. Thought the above code should display individual data on 'newdisplay.php', but it isn't. 😐
-
That was something I wanted to do once a row is fetched. I assume the issue is before it.
Even removing href the result is the same. Why is it displaying the same 1st row for any row clicked !
<?php include 'connection.php'; $qry = "select * from users"; $rs = mysqli_query($conn, $qry); $getRowAssoc = mysqli_fetch_assoc($rs); //while($getRowAssoc = mysqli_fetch_assoc($rs)) echo "<tr> <td>".$getRowAssoc['id']."</td> <td> <img src= '".$getRowAssoc['ptreports']."' height='50px' width='50px'> </td> <td>".$getRowAssoc['fullname']."</td> <td>".$getRowAssoc['bday']."</td> <td>".$getRowAssoc['gender']."</td> <td>".$getRowAssoc['marital']."</td> <td>".$getRowAssoc['cnic']."</td> <td>".$getRowAssoc['address']."</td> <td>".$getRowAssoc['phone']."</td> <td>".$getRowAssoc['complaint']."</td> <td>".$getRowAssoc['history']."</td> </tr>"; ?>
-
<?php include 'connection.php'; $qry = "select * from users"; $rs = mysqli_query($conn, $qry); $getRowAssoc = mysqli_fetch_assoc($rs); //while($getRowAssoc = mysqli_fetch_assoc($rs)) echo "<tr> <td>".$getRowAssoc['id']."</td> <td> <img src= '".$getRowAssoc['ptreports']."' height='50px' width='50px'> </td> <td>".$getRowAssoc['fullname']."</td> <td>".$getRowAssoc['bday']."</td> <td>".$getRowAssoc['gender']."</td> <td>".$getRowAssoc['marital']."</td> <td>".$getRowAssoc['cnic']."</td> <td>".$getRowAssoc['address']."</td> <td>".$getRowAssoc['phone']."</td> <td>".$getRowAssoc['complaint']."</td> <td>".$getRowAssoc['history']."</td> <td><a href='update.php?id=$result[id]'><input type='submit' value=' Update' class='update'><a/> </tr>";
Thanks for your reply.
Last I tried this code but upon clicking "View" for any row it always displays the record for 1st row and not for that particular row. -
This is the original table from where I need a single row extracted, code for which is yet to be written. Hope you got it.
-
I am learning PHP and stuck at a point where I want to extract one row (data for one person with his ID, Image, name, age, address etc) from the table individually and display it in a separate webpage for each user upon clicking View button. I have tried different solutions but failed. Please help.
Following is my table code from where I need to extract data for individual person:
<?php include("connection.php"); error_reporting(0); $query = "SELECT * FROM users"; $data = mysqli_query($conn, $query); $total = mysqli_num_rows($data); if($total != 0) { ?> <h1 align="center">Consultation Console</h1> <table border="2" cellspacing="2" width="100%" cellpadding="3px"> <tr> <th width="2%">ID</th> <th width="10%">Reports</th> <th width="10%">Full Name</th> <th width="6%">D.O.B</th> <th width="2%">Gender</th> <th width="2%">Marital Status</th> <th width="1%">CNIC</th> <th width="8%">Address</th> <th width="3%">Phone</th> <th width="12%">Complaint</th> <th width="8%">History</th> <th width="5%">Operations</th> </tr> <?php while($result = mysqli_fetch_assoc($data)) echo "<tr> <td>".$result[id]."</td> <td> <img src= '".$result[ptreports]."' height='50px' width='50px'> </td> <td>".$result[fullname]."</td> <td>".$result[bday]."</td> <td>".$result[gender]."</td> <td>".$result[marital]."</td> <td>".$result[cnic]."</td> <td>".$result[address]."</td> <td>".$result[phone]."</td> <td>".$result[complaint]."</td> <td>".$result[history]."</td> <td><a href='newdisplay.php?id=$result[id]'><input type='submit' value='View' class='update'><a/> <td><a href='update.php?id=$result[id]'><input type='submit' value=' Update' class='update'><a/> <a href='delete.php?id=$result[id]'><input type='submit' value='Delete' class='delete' onclick = 'return checkdelete()'><a/></td> </tr>"; } ?> </table> <script> function checkdelete() { return confirm('Are you sure you want to delete this record ?'); } </script>
I want to extract one row (data for one person with his ID, Image, name, age, address) individually and display it in a separate webpage for each user.
in PHP Coding Help
Posted
I'm still learning, could you please guide by writing the code using $_GET[id'] to retrieve and display from where I'm stuck.