Tag: php

Having problems loading PHP Driver for SQL Server 2008 Express

I am trying to make use of the PHP driver for MS SQL Server version 1.0. I have everything setup but I think I am having trouble loading up the extension php_sqlsrv_ts.dll. I have gone to the command line and try this: C:\wamp\bin\php\php5.3.0>php.exe –re sqlsrv Exception: Extension sqlsrv does not exist C:\wamp\bin\php\php5.3.0>php.exe –re sqlsrv_ts Exception: […]

How to display arabic characters in web page using php and sql server

How can I display Arabic characters in web page using php and sql server? The Arabic data is stored in the database (sql server). Now I want to use php to display that data on the web page. How can I do this?

Is there a way to set a default cursor type in PDO (specifically PDO_SQLSRV)?

So, annoyingly, the PDO_SQLSRV driver from Microsoft returns -1 on any rowCount() call from a SELECT query with non-scrollable cursors. Further adding to the annoyance, the default cursor type is _FORWARD, meaning that I am seemingly having to add attributes to every prepared statement where I may need to get a row count back (in […]

TSQL Execute result different in PHP and SSManagement Studio

I’m querying a MSSQL Procedure from PHP and SSManagement Studio and the result is different?? This query is getting the fields starting by tKey from the table. Two columns tKey1 and tKey2 exists Procedure sp_myProc DECLARE @tKeys VARCHAR(100); SELECT @tKeys = ISNULL(@tKeys + ‘,’, ”) + column_name FROM testweberp.INFORMATION_SCHEMA.columns WHERE table_name = myTable AND LEFT(column_name, […]

MS SQL connection with PHP fatal error

This question already has an answer here: Call to undefined function mssql_connect() 1 answer

Is Microsoft Drivers 2.0 for PHP for SQL Server Still Around Somewhere?

So version 3.0 is at Microsoft’s download site. Furthermore, there is a line on that page saying Please note that the download link for the 2.0 Driver will be deprecated in the near future Yeah, that’s wonderful and all, but under requirements PHP 5.3.6 or PHP 5.4 I am using 5.2.x and I really should […]

ms sql row_number() function – won't let me use within the same statement

I have a the following sql statement: $sql = “select siteid, row_number() OVER (ORDER BY siteid) as rownum FROM nwsite WHERE rownum >= 4″; “rownum” works when i use the name outside of the query (e.g. in a foreach loop) but when it comes to using it as a WHERE clause it never works. Any […]

Is it possible to store a SQL Server table on the user's local hard drive?

I have a database in a state own ms sql server. Writing user information in a table in the server means that the information is public. I would like to be able to write a table to the users hard drive – so the information is not on the server and be able to access […]

SQL Server stored procedure error while executing from php

I am trying to execute a stored procedure from php. In the php code iam sending a integer parameter to the stored procedure $orderId =824; $result =mssql_bind($sp, “@orderID”, $orderId, SQLINT1, true, false); I getting an error mssql_execute() [function.mssql-execute]: message: The formal parameter “@orderID” was not declared as an OUTPUT parameter, but the actual parameter passed […]

Query in PHP fails to see temp table in SQL Server if parameter binding is used

The following code works as expected (assuming the variables exist): $connectionInfo = [‘Database’=>$dbName, ‘UID’=>$username, ‘PWD’=>$pwd, ‘ReturnDatesAsStrings’=>true, ‘CharacterSet’=>’UTF-8’]; $conn = sqlsrv_connect($server, $connectionInfo); $select = sqlsrv_query($conn, ‘SELECT * INTO #mytable_temp FROM mytable WHERE myfield = \’myvalue\”, []); $select2 = sqlsrv_query($conn, ‘SELECT * FROM #mytable_temp ‘, []); if (!$select2) { $errors = sqlsrv_errors(); var_dump($errors); } else { $res […]

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