taxmanrick Posted August 23, 2010 Share Posted August 23, 2010 So, I'm trying to use arrays as a database of sorts and I am starting to think I can't. I am using a few arrays to manage a football schedule that has dates, game times, team names and scores. I want to be able to display the elements of the arrays in a table form(got this done) and edit it as scores are reported to me or we have rainouts and I need to change game times and or days. What I don't know, is that can you do this as an interactive page??? I know I can go into the code an edit it, but I want others whom I allow to, to be able to edit it from the webpage that displays the data in a table format.Here is what happens...I can load the arrays whit initial values, and display the data in a table. I can change the values in the table. I have a button that calls a function that detects any change in any of the values and is supposed to use splice() to change that value in the array. One major problem I see is that even though it seems to accept the change, when I reload the page, the array that was supposed to change has not been. Even the values in the array, when I look at the code, have not been changed. Am I trying to use arrays in a way they weren't designed to be? Link to comment Share on other sites More sharing options...
ShadowMage Posted August 23, 2010 Share Posted August 23, 2010 So, I'm trying to use arrays as a database of sorts and I am starting to think I can't. I am using a few arrays to manage a football schedule that has dates, game times, team names and scores. I want to be able to display the elements of the arrays in a table form(got this done) and edit it as scores are reported to me or we have rainouts and I need to change game times and or days. What I don't know, is that can you do this as an interactive page??? I know I can go into the code an edit it, but I want others whom I allow to, to be able to edit it from the webpage that displays the data in a table format.Here is what happens...I can load the arrays whit initial values, and display the data in a table. I can change the values in the table. I have a button that calls a function that detects any change in any of the values and is supposed to use splice() to change that value in the array. One major problem I see is that even though it seems to accept the change, when I reload the page, the array that was supposed to change has not been. Even the values in the array, when I look at the code, have not been changed. Am I trying to use arrays in a way they weren't designed to be?That isn't going to work. Javascript arrays only exist as long as the document is active in the browser. If you need permanent storage you need to somehow save your information to a file (a plain text, comma delimited file or xml file) or database. Though I'm not entirely sure if javascript can create txt or xml files. I don't think it can. You'll probably have to use php or some other server-side language. Link to comment Share on other sites More sharing options...
justsomeguy Posted August 23, 2010 Share Posted August 23, 2010 Javascript isn't going to save anything. Users, including yourself, do not have permission to change the source Javascript files, which means that the files they load from the server will always be the same unless you manually upload a new file. You need to save the data, which goes beyond Javascript. You need a server-side language like PHP or ASP that can either write the data to a file or a database, and when the page loads you can read the data from wherever you saved it and format the array for Javascript. Link to comment Share on other sites More sharing options...
taxmanrick Posted August 23, 2010 Author Share Posted August 23, 2010 BUMMER!!!!Thanks for the quick response. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.