You are here: Re: Why is this script so slow? « All PHP « IT news, forums, messages
Re: Why is this script so slow?

Posted by Steve on 03/19/07 02:02

| <?php while ($row = mysql_fetch_array ($result, MYSQL_ASSOC)) { ?>

poor formatting. using:

<?php
while ( condition )
{
?>

makes it easier to follow.

| <tr class="table" >
| <td align='left'><a class="green" href="edit_csf.php?aid=<?=
| $row['person_id'] ?>">

plus, you have short tags enabled...so why are you using <?php anyway?

be consistent.

| <?php
| if (trim($row['last_name']) == '' && $row['first_name'] !=='') {
| echo $row['first_name']; } else {
| echo $row['last_name'] . ', ' . $row['first_name'];
| }
| ?>

you can be more efficient and more clear in your code by assigning variables
the value of $row elements...i.e.:

$firstName = $row['first_name'];

it takes time to pull the correct element value...so, do it once and assign
it to a variable...especially when in a loop.

| <a href="mailto:<?=
| $row['email'] ?>">

this makes it easy for screen-scraping spammers to get an email address to
become a new object of affection.

<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>

perhaps you mean... <?= $row['person_id'] ?>


| <?php
|
| }
| ?>

consistency. ;^)

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация