PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old June 20th, 2004, 01:35 AM
camner camner is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Location: Tacoma, WA
Posts: 2 camner User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
updating a div from a database

I have read some threads on this topic, but am not sufficiently clear on the concept to implement what I want to do...

I have a static page with a hidden <div> that is made visible via a javascript link. The <div> is populated with info from a MySQL database. The div contains a form that is used to update the database.

The way it currently works is that the form reloads the entire page, including the div.

It seems to me that it would be more efficient to have the div updated with new data WITHOUT reloading the entire page.

So, a double-level question:

1. Am I right that reloading the div alone is preferable to reloading the entire page?

2. If 'yes' to #1, how does one do that? innerHTML? Even if there is a fair amount of information? I'm not sure how to use innerHTML when generating an unknown amount of information being pulled from a database.

Thanks....

Reply With Quote
  #2  
Old June 20th, 2004, 11:58 AM
pocketsized pocketsized is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2004
Location: Brunei
Posts: 26 pocketsized User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
How are you going to reload only the div without reloading the entire page? I doubt that's possible.

Reply With Quote
  #3  
Old June 21st, 2004, 09:01 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to dhouston
To do what you're wanting to do, you'd have to load all possible div values from the database and store them. Depending on how much info you're talking about, you may have some problems storing the info. Additionally, you may not be saving yourself anything as far as server resources (requesting a lot of data once isn't necessarily better than requesting much less data several times). There's also the possibility of people's turning js off. I'd consider doing a request for each change. That said, if you want to go with js, you'd just need to store your div content somewhere (hidden fields, say) and then use getElementById() and the innerHTML property to set the content of the div. You can probably do a search on either of these terms within this site to find the code to do it (I'm pretty sure I've typed it out recently).
__________________
Please don't PM me asking for solutions outside the scope of a thread.
Keeping all responses in a thread stands to help others who come along later,
which is after all what this forum's all about.

Reply With Quote
  #4  
Old June 21st, 2004, 10:43 AM
camner camner is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Location: Tacoma, WA
Posts: 2 camner User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thank you both. I'll probably stick with my current method of reloading the entire page.

Reply With Quote
  #5  
Old June 22nd, 2004, 05:50 AM
Pheifel Pheifel is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Location: Denmark
Posts: 174 Pheifel User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 43 m 46 sec
Reputation Power: 5
Send a message via MSN to Pheifel
if you populate the <div> width a <? INCLUDE ""; ?> you can update the specific url of the inclusion.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > updating a div from a database


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT