Im using WAMP sever PHP 5.3.4 and sql server 2008 r2 connect using the driver odbc driver 2011 When i execute this query i got the correct answer,
SELECT [password],[username] FROM [customer]
But having an error While execute the below query,i checked the same query in the sqlserver it gave me the result corrcetly
SELECT [password],[username] FROM customer Where $name=[password] and $pass=[username]
This is what the error im getting
A PHP Error was encountered
Severity: Warning
Message: odbc_exec(): SQL error: [Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Executing SQL directly; no cursor., SQL state 01000 in SQLExecDirect
Filename: models/general_account.php
Line Number: 18
UPDATE:
function login($name,$pass) { var_dump($name); var_dump($pass); $this->load->database(); $conn=odbc_connect('odbcconnection','sa','sa') or die ('error'); $sql='SELECT [password],[username] FROM customer Where $name=[password] and $pass=[username]'; $rs=odbc_exec($conn,$sql) or die('exe error'); odbc_close($conn); }
Thanks in Advance.