php mysql query looping too many times on page load?? -
i running query "forename" , "surname" of "manager" in mysql below - query works fine in mysql when test (it returns 1 result) when page loads on browser name appears more 10,000 times! not sure doing wrong - appreciated, thankyou.
<div id=""> <? $query3 = "select * `lf`.`weekly_report` inner join `lf`.`user_account` on `lf`.`weekly_report`.`manager` = `lf`.`user_account`.`user_id` (date >= curdate( ) - interval dayofweek( curdate( ) ) +6 day) , (date < curdate( ) - interval dayofweek( curdate( ) ) -1 day) , `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>
try moving query out of loop.
$result3 = mysql_query($query3); while ($row2 = mysql_fetch_assoc($result3)) {
you want pdo, mysql_* functions deprecated.
Comments
Post a Comment