mercredi 8 avril 2015

Mysql - Duplicated row only in output


Vote count:

0




I tired to select only one name from a table but the problem is the output is duplicated 3 or 4 times with same result for e.g ( in phpmyadmin there only 5 row when I call it the output duplicated the 5 row be a 20 row


this is code that I used



<?php
$sql = "SELECT * FROM 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>"
. "<td><div class='shorten'><a href='#'>" . $status . "</a></div></td><td>" . $notes . "</td><td>" . $datetime . "</td>"
. "<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 to remove this duplicated result and select only for e.g John Doe when I got to his profile only show his attendance



asked 1 min ago







Mysql - Duplicated row only in output

Aucun commentaire:

Enregistrer un commentaire