[dba-Tech] Dsiplaying MySQL Data in web page

Stuart McLachlan stuart at lexacorp.com.pg
Mon Jul 6 17:41:07 CDT 2009


Jon, see comments in line.

On 6 Jul 2009 at 9:04, John Bartow wrote:

> I have a number of web pages where I don't really need real time access to
> the MySQL data, it doesn't change that often.

Doesn't matter how often it changes. Why did you store it in a mySQL database in the first 
place? Security, volume of data, complexity of the data schema? ????  They are all still 
valid reasons for keeping it there and there is little point in duplicating your data storage and 
pulling from the second store.

> I'm using PhP now but would
> like to display the data within some fancy java scripts. 

There's any reason you can't do both.  Use PHP on the server to  implement any logic, 
retrieve the data  and embed it in the HTML.  Use Javascript and CSS on the client to  
display it.

> Is there a method to use java to display data? 

Java or Javascript?  They are two very different things.

Assuming you mean JavaScript, that's what "Document.write" is for. <g>

 
> Either directly from MySQL or via some
> intermediate method such as writing the data to an xml file, etc.

Java and Javascript are  both client side processors - you need to pass the data to the 
client, your java(script) can't retrieve it from the database. You can either embed you data in 
the HTML file or your HTML file  can retrieve it separately from an XML file on the server.   

If you  want the hassle of parsing it into and back out of XML, then go ahead and put  XML 
data either in the HTML document or in a separate file, but basically XML is a load of cr*p 
for this sort of thing despite the litany of true believers that  it is the solution to all of our 
problems and a harbinger of world peace.   All you will be doing is adding unnecesaary bloat 
that has to be downloaded with each page.  Just use PHP to write a JavaScript array which 
the JavaScript will then use.

  
-- 
Stuart



More information about the dba-Tech mailing list