Click here to Skip to main content
15,908,013 members

Comments by Robin Uters (Top 3 by date)

Robin Uters 19-Jul-19 2:43am View    
Hi Anurag,

Herewith the XML code

Config:
$xmldata = simplexml_load_file("C:\ProgramData\ARAS\EasyVisitor\Config\Config.xml") or die("Failed to load");
$XML_SQL_DataSource = $xmldata->DatabaseConnection[0]["DataSource"];
$XML_SQL_InitialCatalog = $xmldata->DatabaseConnection[0]["InitialCatalog"];
$XML_SQL_UserID = $xmldata->DatabaseConnection[0]["UserID"];
$XML_SQL_Password = $xmldata->DatabaseConnection[0]["Password"];

XML Code:
Hide   Copy Code
<?xml version="1.0" encoding="utf-8"?><Config><DatabaseConnection DataSource="SQLSERVER" InitialCatalog="SQLDATABASE" UserID="SQLUSER" Password="SQLPASSWORD" /></Config>


PHP Code:
Hide   Copy Code
<?php error_reporting(E_ALL);ini_set('display_errors', 1);$connectionInfo = array( "Database"=>$XML_SQL_InitialCatalog, "UID"=>$XML_SQL_UserID, "PWD"=>$XML_SQL_Password);$conn = sqlsrv_connect( $XML_SQL_DataSource, $connectionInfo);if( $conn ) {     echo "Connection established. <br/><br/>	 	 SQL Server: 	$XML_SQL_DataSource <br>	 SQL Database: 	$XML_SQL_InitialCatalog <br>	 SQL Username: 	$XML_SQL_UserID <br>	 SQL Password: 	".md5($XML_SQL_Password)." (For Secure password is encrypted.)<br> 	 ";}else{     echo "Connection could not be established.<br /><br>";     die( print_r( sqlsrv_errors(), true));	 print_r(PDO::getAvailableDrivers());}  ?>


Current Error code:
Connection could not be established.

Array ( [0] => Array ( [0] => IMSSP [SQLSTATE] => IMSSP [1] => -33 [code] => -33 [2] => Invalid value type for option Database was specified. String type was expected. [message] => Invalid value type for option Database was specified. String type was expected. ) )
Robin Uters 18-Sep-18 10:36am View    
Hi LittleGreenDude, I have made a codepen project there you can see my project (-:
Robin Uters 16-Sep-18 13:38pm View    
Thanks, I'll think about it.