A
ui.R
library(shiny)
library(shinyjs)
shinyUI(fluidPage(
bootstrapPage(
)
)
)
Server.R
library(shiny)
library(shinyjs)
mydb=dbConnect(MySQL(),user='',password='123',dbname='test1',host='localhost')
shinyServer(function(input, output,session){
column(4,
textInput("name", label = "NAME:",
value ='')),
column(4,
textInput("address", label = "Address:",
value =''))
column(2,
actionButton("add", "ADD"))
observeEvent(
input$add,
output$ui123 <- renderUI({isolate({
dbSendQuery(mydb,paste("INSERT INTO table1(name,address) VALUES ('",input$name,"','",input$address,"');",sep=" "))
})}))
}
})
If the input to address contains apostrophe (for example:First street's),then it shows an error that the mysql statement contains some error. How can this data be entered without any error into Mysql in R shiny.