php - Mysql - Duplicated row only in output -
php - Mysql - Duplicated row only in output -
i tired select 1 name table problem output duplicated 3 or 4 times same result e.g ( in phpmyadmin there 5 row when phone call output duplicated 5 row 20 row
this code used
<?php $sql = "select * attendance, users "; $result = $db->prepare($sql); $result->execute(); while ($row = $result->fetch()) { $status = $row['status']; $notes = $row['notes']; $datetime= $adminfunctions->displaydate($row['timestamp']); echo "<tr><td><a href='" . $configs->getconfig('web_root') . "admin/adminuseredit.php?usertoedit=" . $row['username'] . "'>" . $row['student_name'] . "</a></td>"; echo "<td><div class='shorten'><a href='#'>" . $status . "</a></div></td><td>" . $notes . "</td><td>" . $datetime . "</td>"; echo "<td class='text-center'><div class='btn-group btn-group-xs'><a href='".$configs->getconfig('web_root')."admin/adminuseredit.php?usertoedit=".$row['username']."' title='edit' class='open_modal btn btn-default'><i class='fa fa-pencil'></i> view</a>"; echo"</tr>"; } ?>
i want remove duplicated result , select e.g john doe when got profile show attendance
if users have id, , before calling sql query know id of user want attendance can alter sql query to
select * users u bring together attendance on u.id = a.user_id u.id = [insert userid]
think it, off top of head.
php mysql select while-loop duplicate-data
Comments
Post a Comment