Tag: php

Ubuntu PHP returning invalid MSSQL Server date format

My PHP/Laravel App is hosted on ubuntu 14, php 5.5. The app is connecting to Sql Server via freetds/odbc. In my freetds.conf I have these settings for date time: [default] date format = %Y-%m-%d %I:%M:%S.%z In my database Datetime is stored as: 2016-12-07 07:11:31.000 When I run query against my db I get this date: […]

Execution of PDO Prepared Statement with SQLSRV causing PHP to crash at Startup

(I’m French, sorry in advance for my english) I had to work with SQLSRV. I used ODBC PDO to connect to the SQLSRV Database. Here’s my code: <?php $pdo = new PDO(‘odbc:Driver={SQL Server};Server=’.$db_host.’;Port=’.$db_port.’;Database=’.$db_name, $db_user, $db_pass); $req = $pdo->prepare(“SELECT id FROM account WHERE username = ?”); $req->execute([$username]); When I execute it, PHP is crashing at startup […]

PHP SQLSRV: passing a string of values to IN clause

I need a way to perform the following query: SELECT * FROM myTable WHERE column NOT IN (‘val1’, ‘val2′) Now, val1 and val2 are inside an array that I’m imploding into a string like this: $inClause = “‘” . implode(“‘,'”, $inClauseArr) . “‘”; If I put the string in the query declaration like this it […]

PHP Script cant see the result of a query in json format, no errors displayed

I am trying to get the values of a table from a MSSQL Database hosted online, however, I cant get any data from it, I already looked several times in the code and cant find a error or some mis-type in the code. I get both echos confirming connection and query were executed but then […]

Printing Submit button for each row

I have problem with my buttons. I will try to explain. 1)I have users db from postgresql and new db in ms sql. 2)Created site with 2 columns in table (“SELECT * from users”-postgresql ): They are id/user 3)Then added new column “Operator” which contain submit buttons and functionality of submit buttons is updating “access” […]

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 […]

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