09-15-2017, 01:34 PM
Ok.. you've got a mysqli calls littered through at least step3. There is no way to create a MSSQL version of userspice using this. I did replace the connection code above and at least get a connection to the mssql db.
mysql connection:
<pre></pre>
mssql connection:
make $dbh in this form: 'hostname, 1433'
<pre></pre>
mysql connection:
<pre>
Code:
$dsn = "mysql:host=$dbh;dbname=$dbn;charset=utf8";
$opt = array(
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC
);
$pdo = new PDO($dsn, $dbu, $dbp, $opt) or die('could not connect');
mssql connection:
make $dbh in this form: 'hostname, 1433'
<pre>
Code:
$dsn = "sqlsrv:server=$dbh;Database = $dbn";
$dsn = "sqlsrv:server=$dbh;Database = $dbn";
$pdo = new PDO($dsn, $dbu, $dbp) or die('could not connect');
$pdo->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
$pdo->setAttribute( PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC );