The Seven Sentence Stories
Idea: A collaborative writing platform, bridging the physical distance and igniting the imaginations of authors around the globe. We wanted the benefit of a social medium focused on writing and idea-making thus TSSS was born. Using this app, people can create new stories, edit existing ones or just read.
changeStory(): this updates another page in our html called “readstory” with the identity of whichever story is clicked on in the main page. Therefore, if you click on “test”, the empty “readstory” page will have the title, story, and collaborator list of “test”.
showStories(): uses the ‘story-list’ get call to list all the stories on the list view page.
filterStories(): uses the ‘story-list’ get call to compare the search input with existing story titles in the database to spit out the stories that exactly match the search.
storyUpdate(): uses the ‘set-story’ get call to add new row in a ‘p’ tag to that page. Also updates the database.
newStory(): uses the ‘set-story’ get call to add a new row for that story to the php database and updates the list of stories on the main page.
In phpMyAdmin, we made a new database called “collab_fiction”. In it we have a table called ‘stories’ with columns, ‘id’, ‘dates’, ‘author’, ‘sentence’, and ‘storyid’. In our index.php, we have four ‘get commands’:
‘Set-story’: adds a new row to the table
‘Get-stories’: lists all rows in the table
‘Get-story’: list all the rows under that storyid
‘Story-list’: lists all unique storyids in the table
Although the story updated instantly, the author list did not update unless you refreshed the page. We tried to fix this by placing the portion of code that controlled the author list within the submit button’s “click” function, but this only generated duplicates. We are still seeking to solve this issue.
I really enjoyed this project because I got to work with phpMyAdmin and MySQL, both of which I’ve heard about but have never seen in action. After making the database and learning the correct jargon to pull information from that database, it was relatively easy to make a for loop in a .getJSON method in our HTML. Then it just became a matter of displaying the specific part of that json, which required a lot of tweaking and still does til this day to perfect. I am satisfied with the work we were able to produce in such a limited time. TSSS works fine individually on your personal devices, if you are able to make a database of the same name with the same table, however this is not ideal. I still want to learn how to put this online, but that is a future challenge.