Hmmmmmm, I'll try that and let you know what happens. It may not work
for this application as another developer is writing the database
code, but this sounds like something we *should* be able to do. I'll
definitely let you know what happens (and thank you for this idea!).




On Apr 1, 3:18 pm, John Callahan <[email protected]> wrote:
> Could you do something like...
>
> tl.loadJSON("myfile.php?"+ (new Date().getTime()), function(json, url) {
> eventSource.loadJSON(json, url);
>
> ...and myfile.php file simply performs the query and returns the array
> of data...
>
> myfile.php would be something like...
> <?php
> ...
> $qresult = mysql_query($query) or die(mysql_error());
> ...
> if (mysql_num_rows($qresult) > 0) {
> $qstring = ...
> while($row = mysql_fetch_array($qresult)){
>     $qstring .=  ...}
>
> echo $qstring;
> ?>
>
> I don't think you need the new Date() extension to the file call here as
> the php file will be executed each time and not stored in cache
>
> - John
>
> **************************************************
> John Callahan
> Geospatial Application Developer
> Delaware Geological Survey, University of Delaware
> 227 Academy St, Newark DE 19716-7501
> Tel: (302) 831-3584
> Email: [email protected]http://www.dgs.udel.edu
> **************************************************
>
> JadedAngel wrote:
> > My apologies in advance if I'm posting this in the wrong place. If
> > that's the case, please let me know where this question should be
> > asked.
>
> > I'm developing an application that will read Timeline data from a
> > mySQL database using PHP. At the moment (just to get things working)
> > we're reading the data and then writing it to a temporary file (called
> > 'myfile.js' in this example), with the data in JSON format.
>
> > The current way Timeline loads the data is through this function:
>
> >  tl.loadJSON("./data/myfile.js?"+ (new Date().getTime()), function
> > (json, url) {
> >    eventSource.loadJSON(json, url);
>
> > Rather than write to a file and then read it back in, we'd like to
> > read from the database then and insert it directly into a javascript
> > variable, something like:
>
> > <?php
> > // php code for reading data from the database goes here,
> > // and the data gets returned as the PHP var "$timeline_data"
> > ?>
> > <script type='text/javascript'>
>
> > // printed via PHP, the data is stuffed into the javascript var 'foo'
> > var foo = <?php echo $timeline_data;  ?>;
>
> > The problem is that I have no idea what javascript variable the data
> > in 'myfile.js' is supposed to end up in. What would I replace the
> > current data file loading lines with to insert the returned data
> > directly into a javascript var so that TimeLine can use it?
>
> > In other words, what Javascript variable does the data loaded through
> > these two lines end up in:
>
> >  tl.loadJSON("./data/myfile.js?"+ (new Date().getTime()), function
> > (json, url) {
> >    eventSource.loadJSON(json, url);
>
> > I thank you in advance for any help you may be able to offer.
>
> > LDM
> > [email protected]
> > (Timeline n00b)

On Apr 1, 3:18 pm, John Callahan <[email protected]> wrote:
> Could you do something like...
>
> tl.loadJSON("myfile.php?"+ (new Date().getTime()), function(json, url) {
> eventSource.loadJSON(json, url);
>
> ...and myfile.php file simply performs the query and returns the array
> of data...
>
> myfile.php would be something like...
> <?php
> ...
> $qresult = mysql_query($query) or die(mysql_error());
> ...
> if (mysql_num_rows($qresult) > 0) {
> $qstring = ...
> while($row = mysql_fetch_array($qresult)){
>     $qstring .=  ...}
>
> echo $qstring;
> ?>
>
> I don't think you need the new Date() extension to the file call here as
> the php file will be executed each time and not stored in cache
>
> - John
>
> **************************************************
> John Callahan
> Geospatial Application Developer
> Delaware Geological Survey, University of Delaware
> 227 Academy St, Newark DE 19716-7501
> Tel: (302) 831-3584  
> Email: [email protected]http://www.dgs.udel.edu
> **************************************************
>
> JadedAngel wrote:
> > My apologies in advance if I'm posting this in the wrong place. If
> > that's the case, please let me know where this question should be
> > asked.
>
> > I'm developing an application that will read Timeline data from a
> > mySQL database using PHP. At the moment (just to get things working)
> > we're reading the data and then writing it to a temporary file (called
> > 'myfile.js' in this example), with the data in JSON format.
>
> > The current way Timeline loads the data is through this function:
>
> >  tl.loadJSON("./data/myfile.js?"+ (new Date().getTime()), function
> > (json, url) {
> >    eventSource.loadJSON(json, url);
>
> > Rather than write to a file and then read it back in, we'd like to
> > read from the database then and insert it directly into a javascript
> > variable, something like:
>
> > <?php
> > // php code for reading data from the database goes here,
> > // and the data gets returned as the PHP var "$timeline_data"
> > ?>
> > <script type='text/javascript'>
>
> > // printed via PHP, the data is stuffed into the javascript var 'foo'
> > var foo = <?php echo $timeline_data;  ?>;
>
> > The problem is that I have no idea what javascript variable the data
> > in 'myfile.js' is supposed to end up in. What would I replace the
> > current data file loading lines with to insert the returned data
> > directly into a javascript var so that TimeLine can use it?
>
> > In other words, what Javascript variable does the data loaded through
> > these two lines end up in:
>
> >  tl.loadJSON("./data/myfile.js?"+ (new Date().getTime()), function
> > (json, url) {
> >    eventSource.loadJSON(json, url);
>
> > I thank you in advance for any help you may be able to offer.
>
> > LDM
> > [email protected]
> > (Timeline n00b)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"SIMILE Widgets" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/simile-widgets?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to