Advertisement
Guest User

Untitled

a guest
Nov 7th, 2016
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. library(shiny)
  2. library(RMySQL)
  3. library(pool)
  4.  
  5. pool <- dbPool(
  6. drv = RMySQL::MySQL(),
  7. user='username',
  8. password='password',
  9. dbname='words',
  10. host='blahblahblah')
  11.  
  12. shinyServer(function(input, output) {
  13. ## function to write to databse
  14. writeToDB <- function(word, vote){
  15. query <- paste("INSERT INTO word_votes (vote, word) VALUES (", vote, ", '", word, "');", sep="")
  16. conn <- poolCheckout(pool)
  17. dbSendQuery(conn, query)
  18. conn <- poolReturn(conn)
  19.  
  20. ## rest of code
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement