Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MSSQL query in CodeIgniter

I want to run MSSQL query in CodeIgniter framework but it is throwing error like:

Error Number: 42S22/207

[Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Invalid column name '1'.

SELECT * FROM user_master WHERE id ="1"

I'm trying to run following query:

SELECT id,fname,lname,username,email FROM user_master WHERE username ="admin" AND password ="123456"

when this same query into MSSQL, it works with a single quotation ('). But when I'm passing variables in the query then it is automatically assigned double quotation.

Suggest some solution.

like image 354
Harsh Dalwadi Avatar asked Mar 31 '26 00:03

Harsh Dalwadi


1 Answers

I faced this issue a while ago I tried turning on query builder in database.php

$query_builder = TRUE;

there might be issue with IIS server cache. Clear cache and try.

I hope this will work

like image 189
Digant Shah Avatar answered Apr 02 '26 04:04

Digant Shah



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!