Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PSQLException: The column index is out of range: 2, number of columns: 1

The following error occured when try to query a list of email with provided email,password. Actually the subscribers_table has 10 columns with column names of email and password.

[PSQLException: The column index is out of range: 2, number of columns: 1.]

My LoginProcess Model code:

    case class LoginProcess(email:String,password:String)

    //error occured in this line
    implicit val getLoginProcessResult = GetResult(r => LoginProcess(r.nextString, r.nextString))

    def check_Login_Success_Query(email: String,password:String) = sql"select email from provisions_schema.subscribers_table where email = $email and password=$password ".as[LoginProcess]

    val login_Success_Query_List = check_Login_Success_Query(email_ip,password_ip).list

    println("login_Success_Query_List.length ->" +login_Success_Query_List.length)
like image 772
Ramprasad Avatar asked Oct 24 '25 03:10

Ramprasad


1 Answers

You do this:

select email from provisions_schema.subscribers_table

And the model expects email and password. Add the password to your query

like image 190
serejja Avatar answered Oct 26 '25 19:10

serejja



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!