SQL query data no rows

shiny
rstudio

#1

I am trying to run a simple query and have the results show up in a widget pickerInput. I am receiving an error of 'Error in $<-.data.frame: replacement has 0 rows, data has 1986

drv <- JDBC(# code for driver)
con <- dbConnect(# code for connection )
# Query
myquery = "select, id, cname from mytable where name != John"

ui <- fluidPage(
  titlePanel("Test"),
  sidebarLayout(
    SidebarPanel(
      uiOutput("my_ui")),
  mainPanel(
)
)
)

server <- function(input,output){
  df_original = reactive({
    df = dbGetQuery(con,myquery)
    df$name = ifelse(is.na(df$name), 'no name info', df$name)

  output$my_ui = renderUI({
    name = df_original()[,"cname"]
    pickerInput("name", label = h3("names:"),
    choices = sort(unique(name)), options = list("action-box" = TRUE, "live-search" = True, "none-selected-text"='Click here to select names'),
selected = NULL, multiple = TRUE)
})
}
      

#2

Here's a pretty good explanation of this type of error message:

My first guess is that you have NULL values in your name column. So, perhaps :
df$name = ifelse(is.null(df$name), 'no name info', df$name)