Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Generating large tables/ grids with loops quickly
Old 10-09-2007, 09:34 AM Generating large tables/ grids with loops quickly
the12thplaya's Avatar
Experienced Talker

Posts: 38
Trades: 0
Hi

I'm trying to find an efficient way of creating tables or grids with small cells, probably with a maximum of a 100 rows and 100 columns. Each cell 2 or 3 pixels high and wide.

It's not the looping I'm having problem with, it's the length of time it takes to load the page that's a big problem. I've tried tables, divs and also creating an image in php with GD and draw what I want on that.

I'm looking to display like a radar/map of an area displaying different colours in the cells to represent certain things. When I do a 10 x 10 grid it's almost instant, it starts to really slow down after that.

Any one have any ideas/ methods that might load quicker than others? I can go with 10 x 10 but when I have a board of a million squares in a database (1000 x 1000) it'll be good to be able to show mini maps of larger sections.

I appreciate the fact that I'm accessing the database each cell probably isn't helping much but when it's almost instant with a 10 x 10 table it seems like it's more of a problem with how I'm drawing the map/ table.

Sorry I've got no code as I'm at work, but it's just a 9 or 10 line program at the moment with the loops and code to access the database and display accordingly.

Thanks

Kevin
the12thplaya is offline
Reply With Quote
View Public Profile Visit the12thplaya's homepage!
 
 
Register now for full access!
Old 10-09-2007, 05:49 PM Re: Generating large tables/ grids with loops quickly
coolkbk585's Avatar
Be good this Christmas!

Latest Blog Post:
KBlog has been deativated
Posts: 642
Name: Kyle
Location: Ada, MI
Trades: 0
Well, would you be able to switch all of the data over to an XML file and then access it with Javascript? I think that it would be faster to load, and it would take more load off the server.
__________________
<?php if($Adsense_Revenue > 0): define('HAPPINES','100%'); else: define('HAPPINESS', '0%') endif; ?>
coolkbk585 is offline
Reply With Quote
View Public Profile Visit coolkbk585's homepage!
 
Old 10-09-2007, 07:54 PM Re: Generating large tables/ grids with loops quickly
the12thplaya's Avatar
Experienced Talker

Posts: 38
Trades: 0
Can it be switched to XML dynamically via php? I've not actually done that before but might look into it.

I've managed to create a 100 small tables all with 10 rows and 10 columns and I've cleaned the code so that it only accesses the database once before it goes into the loop, storing a small part of the million database rows in an array and using that in my loops.

The page load averages at 10 seconds now, which isn't too bad, especially when the page loads and displays progressively so that you can see it's loading and are therefore less likely to move away from the page.
the12thplaya is offline
Reply With Quote
View Public Profile Visit the12thplaya's homepage!
 
Old 10-12-2007, 01:35 PM Re: Generating large tables/ grids with loops quickly
solomongaby's Avatar
Webmaster Talker

Latest Blog Post:
How Do You Find Music Online ?
Posts: 522
Name: Gabe Solomon
Location: Romania
Trades: 1
without seing the code i don't think we can help you to optimizing it
__________________
If you like my posts ... TK is appreciated:)

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
solomongaby is offline
Reply With Quote
View Public Profile Visit solomongaby's homepage!
 
Reply     « Reply to Generating large tables/ grids with loops quickly
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.44708 seconds with 12 queries