title: Query in Shiny R to retrieve the data from the database using reactive input
body: <pre><code>**UI.R**
  
  library(shiny)
  
  shinyUI
    (fluidPage
      (
        titlePanel("Predict"),
  
        sidebarLayout
        (
          sidebarPanel
            (
              (numericInput("tenth", label = h3("X Percentage"), value = 90)) ),
          mainPanel("Main Panel")
        )
      )
  )
  
  
  **Server.R**
  
  library(shiny)
  library(RMySQL)
  
  
  shinyServer(
    function(input,output)
    {
      db &lt;- dbConnect(MySQL(), dbname = "rstudio", host = "localhost", 
                      port = 3306, user = "root", password = "")
  
      query &lt;- sprintf("SELECT * FROM userdetails where SSC = %s",input$tenth)
    }
  )
  </code></pre>
  
  <p><strong>The error</strong>
  Operation not allowed without an active reactive context. (You tried to do something that can only be done from inside a reactive expression or observer.)</p>
  
  <p>I know that I need to add the database query in a reactive expression or isolate. But how do i write that. I need to show the data retrieved to the user and even use the data for further computation.</p>