joequah1 Posted September 26, 2011 Share Posted September 26, 2011 Hi, I knew the way to connect to mysql but i don't know how to connect mssql. Is it the same? here's an example for mysql. please teach me the mssql. $con = new mysqli(DB_HOST,DB_USER,DB_PASS,DB_NAME); $sql = "SELECT COUNT(*) FROM numbers"; $result = $con->query($sql); $r = $result->fetch_row(); thanks Quote Link to comment https://forums.phpfreaks.com/topic/247876-php-connect-mysql-and-mssql-same/ Share on other sites More sharing options...
MasterACE14 Posted September 26, 2011 Share Posted September 26, 2011 You use the MSSQL functions instead of the MYSQLI functions. http://au2.php.net/manual/en/book.mssql.php Quote Link to comment https://forums.phpfreaks.com/topic/247876-php-connect-mysql-and-mssql-same/#findComment-1272816 Share on other sites More sharing options...
joequah1 Posted September 27, 2011 Author Share Posted September 27, 2011 the problem now is i get fatal error every time. can anyone please tell me how to add extension in the php.ini? how should the code look like? i tried but failed. Im using netbeans with xampp. thanks. Quote Link to comment https://forums.phpfreaks.com/topic/247876-php-connect-mysql-and-mssql-same/#findComment-1273063 Share on other sites More sharing options...
jcbones Posted September 27, 2011 Share Posted September 27, 2011 Most extensions are listed in the php.ini, but they need to be enabled. Look for this section: ;;;;;;;;;;;;;;;;;;;;;; ; Dynamic Extensions ; ;;;;;;;;;;;;;;;;;;;;;; ; If you wish to have an extension loaded automatically, use the following ; syntax: ; ; extension=modulename.extension ; ; For example, on Windows: ; ; extension=msql.dll ; ; ... or under UNIX: ; ; extension=msql.so ; ; ... or with a path: ; ; extension=/path/to/extension/msql.so ; ; If you only provide the name of the extension, PHP will look for it in its ; default extension directory. ; ; Windows Extensions ; Note that ODBC support is built in, so no dll is needed for it. ; Note that many DLL files are located in the extensions/ (PHP 4) ext/ (PHP 5) ; extension folders as well as the separate PECL DLL download (PHP 5). ; Be sure to appropriately set the extension_dir directive. ; ;extension=php_bz2.dll ;extension=php_curl.dll ;extension=php_dba.dll ;extension=php_exif.dll ;extension=php_fileinfo.dll extension=php_gd2.dll ;extension=php_gettext.dll ;extension=php_gmp.dll ;extension=php_intl.dll ;extension=php_imap.dll ;extension=php_interbase.dll ;extension=php_ldap.dll extension=php_mbstring.dll ;extension=php_ming.dll ;extension=php_mssql.dll extension=php_mysql.dll extension=php_mysqli.dll ;extension=php_oci8.dll ; Use with Oracle 10gR2 Instant Client ;extension=php_oci8_11g.dll ; Use with Oracle 11g Instant Client ;extension=php_openssl.dll ;extension=php_pdo_firebird.dll ;extension=php_pdo_mssql.dll extension=php_pdo_mysql.dll ;extension=php_pdo_oci.dll ;extension=php_pdo_odbc.dll ;extension=php_pdo_pgsql.dll extension=php_pdo_sqlite.dll ;extension=php_pgsql.dll ;extension=php_phar.dll ;extension=php_pspell.dll ;extension=php_shmop.dll ;extension=php_snmp.dll ;extension=php_soap.dll ;extension=php_sockets.dll ;extension=php_sqlite.dll ;extension=php_sqlite3.dll ;extension=php_sybase_ct.dll ;extension=php_tidy.dll ;extension=php_xmlrpc.dll ;extension=php_xsl.dll ;extension=php_zip.dll Remove the semi-colon before the extension. Of course you need to make sure the file exists in the extensions folder. Quote Link to comment https://forums.phpfreaks.com/topic/247876-php-connect-mysql-and-mssql-same/#findComment-1273066 Share on other sites More sharing options...
joequah1 Posted September 27, 2011 Author Share Posted September 27, 2011 i tried to remove and get mssql extension for it but still failed. I even cant run mysql after making changes. i dont have php.ini but only php. so i make changes to the php only. help please Quote Link to comment https://forums.phpfreaks.com/topic/247876-php-connect-mysql-and-mssql-same/#findComment-1273081 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.