Open EhsanJamshidi opened 5 years ago
Which adapter are you using ?
To debug queries you can decomment, in my code, the following line:
// echo $sql."<br><br>";
and see what command is going to the database.
I use this https://github.com/davideairaghi/php/blob/master/library/Airaghi/PhalconPHP/MSSQL/Adapter/Mssql3.php
this is the phalcon script I have $temp = TblUsers::findFirst(); $this->flash->success('here: '. $temp->name);
I enable the code you said this is what I get now
SELECT TOP :APL0 tblusers.id, tblusers.name, tblusers.email, tblusers.password, tblusers.mustChangePassword, tblusers.profilesId, tblusers.banned, tblusers.suspended, tblusers.active FROM /tbl/ "tblusers"
SQLSTATE[07002]: [Microsoft][ODBC Driver 17 for SQL Server]COUNT field incorrect or syntax error
Which version of ODBC I must use I have Phalcon 3.4.^ php 7.2^ mssql 2017 ODBC Driver 17
have you tried to change your code from
$temp = TblUsers::findFirst();
to
$temp = TblUsers::findFirst(['conditions'=>'id>?0','bind'=>[0]);
I know it should be the same but it can be a test to be done ...
Also, to get better debug information you can change
echo $sql."<br><br>";
to
echo '<pre>' . $sql.'<br><br>'; print_r($bindParams); print_r($bindTypes);
Hi, I'm using Phalcon 3.4.^ php 7.2^ MSSQL 2016
when I use find first or other kind i got this error
SQLSTATE[07002]: [Microsoft][ODBC Driver 13 for SQL Server]COUNT field incorrect or syntax error
0 C:\wamp64\www\hotbookmakers\app\library\db\adapter\Mssql.php(503): PDOStatement->execute()
1 [internal function]: Twm\Db\Adapter\Pdo\Mssql->executePrepared(Object(PDOStatement), Array, Array)
2 C:\wamp64\www\hotbookmakers\app\library\db\adapter\Mssql.php(286): Phalcon\Db\Adapter\Pdo->query('SELECT tblprofi...', Array, NULL)
3 [internal function]: Twm\Db\Adapter\Pdo\Mssql->query('SELECT tblprofi...', Array, NULL)
4 [internal function]: Phalcon\Mvc\Model\Query->_executeSelect(Array, Array, NULL)
5 [internal function]: Phalcon\Mvc\Model\Query->execute()
6 C:\wamp64\www\hotbookmakers\app\library\Acl\Acl.php(171): Phalcon\Mvc\Model::find(Array)
7 C:\wamp64\www\hotbookmakers\app\library\Acl\Acl.php(101): Hotbookmakers\Acl\Acl->rebuild()
8 C:\wamp64\www\hotbookmakers\app\library\Acl\Acl.php(73): Hotbookmakers\Acl\Acl->getAcl()
9 C:\wamp64\www\hotbookmakers\app\controllers\ControllerBase.php(53): Hotbookmakers\Acl\Acl->isAllowed('Administrators', 'users', 'index')
10 [internal function]: Hotbookmakers\Controllers\ControllerBase->beforeExecuteRoute(Object(Phalcon\Mvc\Dispatcher))
11 [internal function]: Phalcon\Dispatcher->dispatch()
12 C:\wamp64\www\hotbookmakers\public\index.php(41): Phalcon\Mvc\Application->handle()
13 {main}