Tag: php

Call to undefined function sqlsrv_connect() with PHP 7 and SQL 2016 Express

I have read a few posts referring to older versions of PHP and MS SQL connectivity but does not seem able to help me with my similar issue. I am running… Windows Server 2012 PHP 7.09 MS SQL 2016 Express I have installed the following drivers from Microsoft php7.dll php_pdo_sqlsrv_7_nts_x64.dll php_sqlsrv_7_nts_x64.dll (Microsoft seems to have […]

How can I select fields from Cronus Sales Invoice Header table using php sqlsrv?

I am trying to connect and select all fields on the Sales Invoice Header table and echo only the ‘No_’ field. I am using php with the sqlsrv extension. When I run it I get this error: Array ( [0] => Array ( [0] => 42S02 [SQLSTATE] => 42S02 [1] => 208 [code] => 208 […]

MSSQL datetime datetime in php

I have a problem where i think exist a couple solutions. scenario I have build this intranetpage where internal performance KPI’s are visible for the office. The data is extracted from a MSSQL database and shown on the webpage in combination with PHP, than the data and converted to an array so Google Chart API […]

SQL sub query from PHP PDO query

i have a question, i’m trying to execute a MSSQL query from PHP, i executed the query directly in SQL SERVER and not problem, but if i execute the query from PHP PDO i don’t get any result, testing the query without the sub query i got results without problems but if i do it […]

Sql_srv query execution takes long time

I have too many tables in my database and also a huge data. in this query i’m querying from two tables, and i’m also using a function “DTtoUnixTS” to convert the date to the unixtime. but the problem is that the query takes too long time (about 6 to 7 seconds) and i have treid […]

How to code SQL for a filter via list of checkboxes

So I am about to make a webpage where users can check/uncheck from a list of filters, and then see the products relevant to them. Similar to Wayfair.com, but MUCH smaller scale. (ex: https://www.wayfair.com/Floor-Lamps-l6238-c416504-O76363~Modern.html) I use parameterized queries in PHP — should I code the logic for this in PHP or SQL? Here is a […]

Multiple Recordset/Columns echo to PHP from MSSQL stored procedure

I’m trying to run a MSSQL stored procedure with PHP and then take results and echo them to a page. The results output as two different recordsets with a bunch of columns. See screenshot. I’ve modified some of the variable names and output to protect some sensitive information, but the SQL code below is exactly […]

PHP Array duplicates: every string key has numeric key

I’m trying to get an array with utf-8 values from an MS-SQL query. Nearly everything works fine, except that the result array looks like this: Array ( [id] => 1; [0] => 1; // this is redundant [countryName] => england; [1] => england; // this is redundant ) I don’t want the duplicate numeric keys. […]

mssql_query(): Query failed

I have a script, which makes a query to a remote database, now the problem is that sometimes it returns this error. Most of the time it is working, but still the error persists in like 5 out of 10 runs of the script. Data is always the same, query doesn’t change too. mssql_get_last_message(); Doesn’t […]

Get squared characters sql-server

Here are the characters in database ( last line ) : When I var_dump, the squared characters disapears: And I need to get that squared characters.

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