Reputation: 27
I am running a query to get the "forename" and "surname" of "manager" in the mysql below - the query works fine in mysql when I test it (it returns one result) however when the page loads on my browser the name appears more than 10,000 times! I am not sure what I am doing wrong - any help would be greatly appreciated, thankyou.
<div id="">
<?
$query3 = "SELECT * FROM `lf`.`weekly_report` INNER JOIN `lf`.`user_account` ON `lf`.`weekly_report`.`manager` = `lf`.`user_account`.`user_id` WHERE (DATE >= CURDATE( ) - INTERVAL DAYOFWEEK( CURDATE( ) ) +6 DAY) AND (DATE < CURDATE( ) - INTERVAL DAYOFWEEK( CURDATE( ) ) -1 DAY) AND `p_code` = '" . $pCode . "'";
echo "<table border=1 cellpadding=5 width=30% style='border-collapse:collapse; height:auto; font-size:small; float:left;'>";
echo "<tr>";
echo "<th style='background-color:#FFFFCC;'>Project Manager</th>";
while ($row2 = mysql_fetch_assoc(mysql_query($query3))) {
echo "<td style='background-color:#FFFFFF;text-align:left;'>" . $row2['forename'] . " " . $row2['surname'] . "</td>";
}
echo "</tr>";
echo "</table>";
?>
</div>
Upvotes: 1
Views: 223