Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > Web Development
You last visited: Today at 19:43

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Help PDO Driver for sqlsrv

Discussion on Help PDO Driver for sqlsrv within the Web Development forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Jan 2014
Posts: 258
Received Thanks: 152
Exclamation Help PDO Driver for sqlsrv

Hello guys how add pdo driver for sqlsrv?
I need for this

TinLevin is offline  
Old 05/10/2014, 11:24   #2
 
elite*gold: 0
Join Date: Oct 2012
Posts: 71
Received Thanks: 24
Warum die Fehlermeldung jetzt kommt kann ich jetzt nicht genau sagen aber dein Code wird sowieso nicht funktionieren den du kannst nicht außerhalb einer Funktion auf interne Dinge zugreifen.

Man kann es aber mit Hilfe von einer Statischen Funktion oder gleich mit den Konstruktor lösen.
Statischen Lösung.
PHP Code:

class Sql  {

     static public  function 
Connect()
     {

    
$engine   '';
        
$host     '';
        
$port     '';
        
$database '';
        
$user     '';
        
$pass     '';
    
$dns $engine.':host='.$host.";port=".$port.";dbname=".$database;
        
$db = new PDO($dns$user$pass);
       return 
$db;
     }

    

Konstruktor

PHP Code:
class sqlConnect extends PDO {

    public function 
__construct() {
    try {
        
$engine '';
        
$host '';
        
$port '';
        
$database '';
        
$user '';
        
$pass ='';
        
$dns $engine ':host=' $host ';port=' $port ';dbname=' $database;
        
parent::__construct($dns$user$pass);
    } catch (
PDOException $e) {
        echo 
'Fehler: ' htmlspecialchars($e->getMessage());
    }
    }


_robox is offline  
Thanks
1 User
Reply


Similar Threads Similar Threads
[RELEASE]PHP 5.4/PHP Driver 3.0(SQLSRV) Account Registration Module
04/14/2018 - Rappelz Private Server - 23 Replies
Hello Community, Today during some of my free time I was organizing some of my older projects that I plan to revise or revamp. I have long since seen many people here that are looking for proper registration scripts which this community is lacking in! Some of you may be using or may have used my ASPX script. But then again, some just don't want to tangle with ASPX and would prefer a more simplistic resolution to their registration difficulties, but you still want to remain protect no? ...
[RELEASE] SQLsrv PHP Tester
03/11/2014 - Dekaron Private Server - 4 Replies
This script can test your mssql connection and check if you have sqlsrv installed on php Just edit this file ("sqlsrv_test.php") and upload to your server you want to check! Have fun, and DONT forget to say Thanks!
Microsoft ODBC Driver Mangaer Driver
02/17/2013 - WarRock - 4 Replies
Wo kann ich Microsoft ODBC Driver Mangaer Treiber Downloaden ? falls jemand mir helfen will bitte per skype = thekingofff Wenn ich mein Server starten will kommt die meldung weitere infos per skype pls help ich finde die treiber nicht >.< Microsoft ODBC Driver



All times are GMT +1. The time now is 19:44.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.