Though your code isn't the cleanest I've seen I don't think there is
anything inherently wrong with your proceedure.  You're just displaying a
LOT of information.  And more importantly you're displaying this in a
browser with HTML tables.  I'd put a timer on your code to see how much time
the actual query took.  Then subtract that from the time it took to render
the information in the browser window and you can get a pretty good feel for
where your bottle neck is.  I susspect the query will be a small percentage
of the total time involved.

Look into the microtime() to setup the timer.  Good luck.

-Kevin

----- Original Message -----
From: "Pong-TC" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, June 13, 2002 3:40 PM
Subject: [PHP] Code Improvement


> Hello All
>
> I run the simple code to display data from the database.  There are around
> 5000 records and 50 fields.  It takes around 1 1/2 min to retrieve the
> data to the browser.  I'd like to know if we can improve my code.  So, I
> can retrieve the data in a shorter period of time.  I have codes as
> follows:
>
> $conn = (mssql_connect("20.23.252.3","hello","hello")) or die("Cannot
> connect to the database.");
> mssql_select_db("research",$conn);
>
> $strSQL = "Select * from dss_student order by stuidterm";
> $rs = mssql_query($strSQL,$conn) or die("Cannot connect to the table");
>
> echo "<table border='0' cellspace=1><tr>";
> echo "<th bgcolor='#faf0e6'><font face='verdana' size=2>NO.</font></th>";
>
> while($fld = mssql_fetch_field($rs)){
> echo "<th bgcolor='#faf0e6'><font face='verdana' size=2>" . $fld->name .
> "</font></th>";
> }
>
> echo "</tr>";
>
> $no_row = 1;
> while ($row = mssql_fetch_row($rs)){
> if (($no_row % 2) == 1)
> echo "<tr>";
> else
>     echo "<tr bgcolor='#faf0e6'>";
>
> echo "<td><font face='verdana' size=2>$no_row</font></td>";
> for ($i=0;$i<=49;$i++)
> echo "<td><font face='verdana' size=2>$row[$i]</font></td>";
> $no_row++;
> }
> echo "</table>";
> mssql_close();
>
> POng
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



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

Reply via email to