Tag: php

MSSQL 2012 : PIVOT typologies and dates using PHP

I don’t understand correctly how pivot is working with MSSQL, and I’m not able to apply pivot with my needs. I have a MSSQL 2012 Database with a “typology” content : Date (Unix) | Typo | Other data 1459461600 | Typo 1 | — 1459461600 | Typo 4 | — 1459548000 | Typo 2 | […]

PHP Warning: PHP Startup: Unable to load dynamic library php_pdo_mssql.dll

Yesterday I reinstalled my windows and after installed Apache and copied PHP from dir. And now I can not get access to PDO MS SQL Server. In my php.ini ; is absent: extension=php_pdo.dll extension=php_pdo_mssql.dll and in D:\Program Files\PHP\ext dll files is exsist. When I call PDO script from browser I have this error: could not […]

getting metadata from table sql server (php)

I’m trying to get metadata from the tables on my database (sql server). I execute the query to get that metadata on Sql Management Studio and it works but on php script show that error when i do : $row=sqlsrv_fetch_array($res): “Unexpected SQL type encountered in calc_string_size.” I suspected that the problem was on the build […]

Fatal error: Call to undefined function mssql_connect() in php

I’m running Windows Server, MS Sql and IIS6. I am trying to connect php to ms sql database, and I keep getting the following error from the script Fatal error: Call to undefined function mssql_connect() in …. on line x I have install zend studio in C:\Program Files\Zend\ZendStudio-5.5.0 directory. Configure IIS server and set the […]

Error when trying to insert date into datetime column

I have a form that is trying to insert some data into an SQL Server 2008 database. The form has a function to get the current date/time and then insert it into the database as follows; $now = date(“Y-m-d H:i:s”); $q = “INSERT INTO “.TBL_USERS.” ( username, password, userid, userlevel, email, created, updated, timestamp, fullname, […]

Yii – How to get data from another model

Good morning How do I get a data from another model.? I have a search field where I need to search a project name. then my Cgridview will display the selected projects. I have this in my relations public function relations() { return array( ‘project’ => array(self::BELONGS_TO, ‘RmProjects’, ‘project_id’), ); } i tred to access […]

PHP sqlsrv: passing a resource from a function

PHP 5.4.14 SQL Server 2012/SQL Client 2012 Windows 2008 R2 I have a function (simplified version follows) that I call to run a SQL query. It works correctly: connects to DB; runs query and obtains a valid resource. The problem is that the resource that gets returned is null… function squeal($query) { $serverName = “XXXXXXXX\SQLEXPRESS”; […]

Connecting to MSSQL server 2008 with PHP

We are using MSSQL server 2008 on Win server 2008 R2 and have installed Apache (2.2.19) and PHP (5.2.17) separately. We have installd the MSSQL module for PHP and usingthe following connection string: $myc = mssql_connect(Server, SiteDatabaseUsername, SiteDatabasePassword) or die(‘Can\’t connect to mssql Database Server: ‘.mssql_get_last_message($myc)); $db = mssql_select_db(SiteDatabaseName, $myc) or die(‘Can\’t find database: ‘.mssql_get_last_message($myc)); […]

Can I set a query timeout when using Zend_Db_Adapter_Pdo_Mssql?

We have a PHP application (hosted on Linux) which uses Zend Framework components to query a Microsoft SQL Server 2008 database. The PHP application is hosted in a datacenter with reliable internet connection, but the SQL Server database is at the far end of a VPN connection that drops out regularly. The issue we have […]

Getting the id of the last inserted record from an MSSQL table using PDO and PHP

I am trying to get the id of the last record inserted in an mssql database using pdo via php. I HAVE read many posts, but still can’t get this simple example to work, so I am turning to you. Many of the previous answers only give the SQL code, but don’t explain how to […]

MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.