i am writing a php program to read simplexml file.
i get the following error
Parse error: syntax error, unexpected T_STRING in /Applications/MAMP/htdocs/TestSite/sqlconnectstring.xml on line 1

here is the php file

include ('sqlconnectstring.xml');
	
	class sqlConnection
	{
		var $server;
		var $user;
		var $pass;
		
		function __construct()
		{
			$xml = new SimpleXMLElement($xmlstr);
			//$xml = simplexml_load_file("sqlconnectstring.xml")
			
			$this->server = $xml->sql[0]->server;
			$this->server = $xml->sql[0]->user;
			$this->server = $xml->sql[0]->pass;

and here is the xml file

<?xml version="1.0" encoding="UTF-8"?>
<sql>
    <server>
        localhost
    </server>
    <user>
        client
    </user>
    <pass>
        1qaz2wsx
    </pass>
</sql>

You should remove the include and use simplexml_load_file(). You cannot just include an xml file.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.