|
Posted by kenoli on 03/18/07 21:10
The following code is extracting all fields from all records from a
mysql database that has about 250 records in it. Firefox takes over
one minute to extract these records and display them in rows in a
table using the code included below. Safari takes about 30 seconds.
Even after the page displays, the scrolling is a little eratic.
When I use another script to extract the same data and display the
first and last names in one column, it takes about 3 seconds from
start to finish. So I believe it is not the database or the server.
I can only conclude it is the script.
I pulled as much html our of print(), echo() and heredoc commands as
possible. I had suspected the "if" conditionals that set the check
boxes as checked or not and tried various options here like setting
these values to variables and inserting the variables into the html
instead of the whole statement and even removing them altogether and
nothing changed.
I've used the same select/option code in other scripts that work fine.
Help. What is my problem?
Thanks,
--Kenoli
I've included the query and the while loop that creates the table rows
of concern.
If you want to see it operate in real time, you can try it out here:
http://sfnan.org/nandb/pages/lookup_results.php?all=all
It's not live data.
$query = 'SELECT * FROM tbl_person ORDER BY last_name ASC;';
$result = mysql_query($query);
<?php while ($row = mysql_fetch_array ($result, MYSQL_ASSOC)) { ?>
<tr class="table" >
<td align='left'><a class="green" href="edit_csf.php?aid=<?=
$row['person_id'] ?>">
<?php
if (trim($row['last_name']) == '' && $row['first_name'] !=='') {
echo $row['first_name']; } else {
echo $row['last_name'] . ', ' . $row['first_name'];
}
?>
<a/></td>
<td align='left'><input type="text" name="contact[]" value="<?=
$row['contact_person'] ?>" size="7" maxlength="25" ></td>
<td align='center'><input type="checkbox" <?php if ($row['mail']
== 'Y') {echo 'checked';}?> name="mail[]" value="Y"></td>
<td align='center'><input type="checkbox" <?php if ($row['letter']
== 'Y') {echo 'checked';}?> name="letchk[]" value="Y"></td>
<td align='center'>
<select name="confchk[]">
<option value="<?=$row['confirmed'] ?>"> <?=
$row['confirmed'] ?></option>
<option value="Y">Y</option>
<option value="N">N</option>
<option value="M">M</option>
<option value="U">U</option>
</select>
</td>
<td align='center'><input type="checkbox" <?php if
($row['confirmation_sent'] == 'Y') {echo 'checked';} ?> name="conf[]"
value="Y"></td>
<td align='left'><input type="text" name="email[]" value="<?=
$row['email'] ?>" size="20" /> <a href="mailto:<?=
$row['email'] ?>"><img src="../assets/sq_buttons/send.png" alt="Send"
class="button"/><a/></td>
<td align='center'><input type="text" name="note[]" value="<?=
$row['admin_comment'] ?>"size="30" >
<input type="hidden" name="id[]" value="{$row['person_id']}"></td>
</tr>
</form>
<?php
}
?>
</table>
[Back to original message]
|