Tag: php

My Query Works in Database but Not in My Script

I have a dropdown list populated by this query: $sql = “SELECT DISTINCT CAST(MR_ID AS INT) AS MR_ID FROM Stage_Rebate_Index”; Then I had a table that would display values in a table based on the selection of the dropdown. I used this query to do so. Everything worked! $sql_one = “SELECT CAST(Supp_ID AS INT) AS […]

Minimum 5 character match in sql-server table columns(containing string)

Consider two sql-server table columns Column1 Column2 mr white james bond james cameron gordon ramsay Harry Gordon Selfridge I need to select these tables are equal by comparing 5 letters match in name. Example Name mr white james bond and james cameron contains common five letter word james. Name gordon ramsay and Harry Gordon Selfridge […]

SQL Server Table to MySQL Table

I have a problem when importing a table form SQL Server to MySQL. This is what I do: First I export a CSV file with the data of the table Clients from SQL Server. Then I import that CSV file to an auxiliar table in MySQL. Finaly, I execute a query to insert the new […]

How to connect SQL Server 2008 R2 to PHP?

I’m using XAMPP locally as my server for the project and database, I need one MySQL database (locally) to save data but I need to connect to another database (on the same network) to get the registred users, this database is on a SQL Server 2008 R2 Server. How can I connect my project with […]

UPDATE Doesn't Work Even Though I Get Success Response in Console

I have a table with that can be edited if an Edit button is pressed. You can then press the button again after changing information, and it runs an UPDATE query that should update the information in the database. In my console, it shows that all information is being read correctly and I even get […]

php mssql escape special characters

Trying to run the following query string (against MS SQL Server) which includes special characters. How do I do this? select top 1 Contact_CustomData.CustomFields.value(‘(/CustomFields[1]/GiftCard)[1]’, ‘varchar(100)’) from Contact_CustomData; This query (when executed directly on the db) works fine. Just need to escape these characters somehow.

mssql echo certain results

This is my first post here on stackoverflow but i used the site many many times so first of all i wanna thank you guys for all the great answers that you shared with the world. I used google and the search function before i post here but i couldnt find an answer that solved […]

sql query not working for stored procedure in PHP

I have a stored procedure in sql server.When I try to use the php function to get the results,its not working. echo mssql_query(exec MOB_uspcommunication_details $userID,’send’); This gives result as 1 instead of resourceID.When I run the query in sql server its giving me the result. When I change the second parameter to some other value […]

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

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