Hello,

Currently the following section of code is taking over 30 seconds to complete.
It basically returns from a database 30,000 records.

What changes do any of you recommend that would speed of
the following code?

Thank you , 
lee leahu
[EMAIL PROTECTED]

<snip>
                while ($row = mysql_fetch_array($results))
                {

                        /* get each field */
                        $shipdate = trim($row['shipdate']);
                        $currentship = trim($row['currentship']);
                        $orderdate = trim($row['orderdate']);
                        $ponumber = trim($row['ponumber']);
                        $custid = trim($row['custid']);
                        $cust = trim($row['cust']);
                        $prinid = trim($row['prinid']);
                        $prin = trim($row['prin']);
                        $orderamount = trim($row['orderamount']);
                        $territory = trim($row['territory']);
                        $ordersource = trim($row['ordersource']);
                        $confirm = trim($row['confirm']);
                        $currentamount = trim($row['currentamount']);
                        $orderstatus = trim($row['orderstatus']);
                        $changeorder = trim($row['changeorder']);
                        $notes = trim($row['notes']);

                        /* round the amounts */
                        $orderamount= number_format($orderamount, 2, '.', ',');
                                $currentamount = number_format($currentamount, 2, '.', 
',');

                        /* show only date portion of orderdate */
                        $orderdate = split(" ", $orderdate);
                                $orderdate = strtotime($orderdate[0]);
                                if ($orderdate > 0)
                                {
                                        $orderdate = date("m/d/Y", $orderdate);
                                }
                                else
                                {
                                        $orderdate = "";
                                }

                                $shipdate = split(" ", $shipdate);
                                $shipdate = strtotime($shipdate[0]);
                                if ($shipdate > 0)
                                {
                                        $shipdate = date("m/d/Y", $shipdate);
                                }
                                else
                                {
                                        $shipdate = "";
                                }

                                $currentship = split(" ", $currentship);
                        $currentship = strtotime($currentship[0]);
        if ($currentship > 0)
        {
                $currentship = date("m/d/Y", $currentship);
        }
        else
        {
                $currentship = "";
        }


                        /* replace ' with \' */
                        $cust = str_replace("'", "\'", $cust);
                        $prin = str_replace("'", "\'", $prin);
                        $notes = str_replace("'", "\'", $notes);
                        $cust = str_replace("\"", "\'", $cust);
                        $prin = str_replace("\"", "\'", $prin);
                        $notes = str_replace("\"", "\'", $notes);

                                /* display information */
                                ?>
                                <table border="0" cellpadding="0" cellspacing="0">
                                        <tr>
                                                <td class="result"><a href="#" 
onClick="senddata('<?php echo $ponumber; ?>', '<?php echo $custid; ?>', '<?php echo 
$cust; ?>', '<?php echo $prinid; ?>', '<?php echo $prin; ?>', '<?php echo $orderdate; 
?>', '<?php echo $shipdate; ?>', '<?php echo $orderamount; ?>', '<?php echo 
$territory; ?>', '<?php echo $ordersource; ?>', '<?php echo $confirm; ?>', '<?php echo 
$currentamount; ?>', '<?php echo $currentship; ?>', '<?php echo $orderstatus; ?>', 
'<?php echo $changeorder; ?>', '<?php echo $notes; ?>');"><nobr><?php echo $ponumber; 
?></nobr></a></td>
                                                <td width='15'>&nbsp;&nbsp;</td>
                                                <td class="result"><nobr><?php echo 
$cust; ?></nobr></td>
                                                <td width='15'>&nbsp;&nbsp;</td>
                                                <td class="result"><nobr><?php echo 
$orderdate; ?></nobr></td>
                                                <td width='15'>&nbsp;&nbsp;</td>
                                                <td class="result"><nobr><?php echo 
$orderamount; ?></nobr></td>
                                                <td width='15'>&nbsp;&nbsp;</td>
                                                <td class="result"><nobr><?php echo 
$prin; ?></nobr></td>
                                        </tr>
                                </table>
                                <?php


                        }
                        ?>

                        </table>

                <script language="Javascript">
                <!--
                document.all.pleasewait.style.visibility='hidden';
                document.all.pressnow.style.visibility='visible';
                //-->
                </script>

      <?php

                }
<snip>



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to