目前小弟利用r shiny+mysql製作會員登入系統
但碰到一問題,就是當資料庫裡面的會員帳密相同時,我應該如何讓他進入首頁
目前我是先讓他印出表格
# Define UI for application that draws a histogram
ui <- fluidPage(
# Application title
titlePanel("統資幣登入系統"),
# Sidebar with a slider input for number of bins
sidebarLayout(
sidebarPanel(
),
# Show a plot of the generated distribution
mainPanel(textInput(inputId="account1",
label="帳號"),
textInput(inputId="password1",
label="密碼"),
submitButton("送出"),
tableOutput("value3")
)
)
)
# Define server logic required to draw a histogram
server <- function(input, output) {
output$value3 <- renderTable({
con = dbConnect(RMySQL::MySQL(),
user="03351220",
password="03351220",
host="localhost",
dbname="03351220")
queryStr1 = paste("SELECT * FROM `login` WHERE `ACCOUNT`='",input$account1,"' and `PASSWORD`='",input$password1,"'",sep="")
dbGetQuery(conn=con, statement=queryStr1)
dbDisconnect(con)
})
}
# Run the application
shinyApp(ui = ui, server = server)