Avatar of beridius
beridius
 asked on

php mssql

I have a connection to a ms sql server I would Like to have the same kinder setup that I use with mysql where I call the connection into a recordset and be able to access different columns using

$row_recordset1['column name ']

instead of a array
PHP

Avatar of undefined
Last Comment
beridius

8/22/2022 - Mon
Chris Sandrini

How do you connect to the mssql server? PDO?
Pratima

Dave Baldwin

What version of PHP do you have?  What OS/Webserver?  Which version of MS SQL server?  

Details are important here.  PHP 5.2 and below on Windows can use the php_mssql driver while PHP 5.3 and above can not.  PHP 5.3 and above must use sqlsrv driver for direct access.  With the correct SQL Native Client installed, you can also use ODBC to connect.  PDO driver is available in some variations also.

What code are you using right now?
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
rinfo

use adodb.inc.php
http://adodb.sourceforge.net/
you will have similar function to mssql.
ASKER CERTIFIED SOLUTION
Ray Paseur

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Dave Baldwin

@beridius does not seem to be responding so we can't know what's going on with him.
beridius

ASKER
sorry thanks for your post the connection to mssql is mssql_query with mssql_fetch_assoc($data))


I dont use PDO. the PHP version is 5.3.14

here is one of my connections
$data = mssql_query("
SELECT      sum(Transactions) + sum(Duplicates)
FROM [SQL01].[dbo].[KPIDay_T]
WHERE        (iDHClientID = 90) AND (UpdtdWhn BETWEEN CONVERT(DATETIME, '$date1', 102) AND CONVERT(DATETIME, '$date2', 102))");
$row = mssql_fetch_assoc($query);

Open in new window

⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
beridius

ASKER
Thanks Ray I checked my Code and you was right I was using a array thanks so much