Re: mysql long query - advise needed
| From: | (Erwin Hermans) | Date: | Mon, 11 Sep 2000 17:51:58 +0000 |
| Subject: | Re: mysql long query - advise needed | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-2799@lists.php.net to get a copy of this message | ||
On 11 Sep 2000 08:46:14 -0700, pedro@siliconartists.com (Pedro Garre)
wrote:
>- I think the data is not sent to the client until the "</table>" tag is
>written. Maybe the user will be more patient if he starts seing the results
>little by little. To achieve that you may consider spliting the big table in
>small tables (say 50 rows per table, or, better, with a logical criteria).
>
In my experience the data is sent to the client, but a table is not
shown with almost any browsers until the browsers meet the
"</table>"-tag. Netscape does not show the table at all if it doesn't
find this tag.
Maybe you could do something like
1) headers:
<table ...>
<tr> <th> ... </th> ... </tr>
</table>
2) the actual data:
<?
$result = mysql_db_query("mydb","my select statement");
while($row = mysql_fetch_row($result))
{
?>
<TABLE>
<TR>
<TD>
<? echo $row[9]; ?>
</TD>
<TD>
<? echo $row[9]; ?>
</TD>
</TR>
</TABLE>
.....
<? }
mysql_free_result($result);
?>
In that way, the users see row per row, when it is sent to their
client. You just have to watch out a little bit with the layout. Maybe
you could add the with-attribute to the TD-tags.
Then you would have something like "<TD WIDTH='40%'>". Hope this
helps.
>----- Original Message -----
>From: "Dor Juravski" <dorz@inter.net.il>
>To: <php-db@lists.php.net>
>Sent: Monday, September 11, 2000 6:25 PM
>Subject: [PHP-DB] mysql long query - advise needed
>
>
>>
>> Hello,
>> I'm querying about 200-300 rows to a single HTML page. After a lot of
>affort
>> this is taking 20-30 seconds. It used to be almost a minuit. I to find a
>way
>> to do it faster. The table is simple, and I've put indexes & everything.
>>
>> my method right now is creating a table like this:
>> -------------------------------------------------->>>>>
>> 1) headers:
>> <table ...>
>> <tr> <th> ... </th> ... </tr>
>>
>> 2) the actual data:
>>
>> <?
>> $result = mysql_db_query("mydb","my select statement");
>> while($row = mysql_fetch_row($result))
>> {
>> ?>
>> <TR>
>> <TD>
>> <? echo $row[9]; ?>
>> </TD>
>> <TD>
>> <? echo $row[9]; ?>
>> </TD>
>> .....
>> <? }
>> mysql_free_result($result);
>> ?>
>> -------------------------------------------------->>>>>
>> (end of demonstration)
>>
>> I must use this method. I cannot insert the table-html into the php-code.
>> Please help me because I am out of ideas... note that the machine is fast,
>> and nothing is wrong in the database, the server is fast, and only this
>....
>> :(
>>
>> Thank you for reading this extremely long document.
>> Dor
>>
>>
>>
>> --
>> PHP Database Mailing List (http://www.php.net/)
>> To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
>> For additional commands, e-mail: php-db-help@lists.php.net
>> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>>
>>
>
>
>
>--
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
>For additional commands, e-mail: php-db-help@lists.php.net
>To contact the list administrators, e-mail: php-list-admin@lists.php.net
>