i have a class called sqlConn.php within the same directory as hiuser.php
how do i call that class.

include('sql_Conn.php');
	
	$sql = new sql_Conn;

does not work i get

Warning: include(sql_Conn.php) [function.include]: failed to open stream: No such file or directory in /Applications/MAMP/htdocs/TestSite/hiUser.php on line 10

Warning: include() [function.include]: Failed opening 'sql_Conn.php' for inclusion (include_path='.:/Applications/MAMP/bin/php5/lib/php') in /Applications/MAMP/htdocs/TestSite/hiUser.php on line 10

Fatal error: Class 'sql_Conn' not found in /Applications/MAMP/htdocs/TestSite/hiUser.php on line 12

i have a class called sqlConn.php within the same directory as hiuser.php
how do i call that class.

include('sql_Conn.php');
	
	$sql = new sql_Conn;

does not work i get

Warning: include(sql_Conn.php) [function.include]: failed to open stream: No such file or directory in /Applications/MAMP/htdocs/TestSite/hiUser.php on line 10

Warning: include() [function.include]: Failed opening 'sql_Conn.php' for inclusion (include_path='.:/Applications/MAMP/bin/php5/lib/php') in /Applications/MAMP/htdocs/TestSite/hiUser.php on line 10

Fatal error: Class 'sql_Conn' not found in /Applications/MAMP/htdocs/TestSite/hiUser.php on line 12

is the file sql_Conn.php in the same directory as the file you are including it from? Also check that you have not inadvertantly made an error in the filename of the physical file in the directory. 1 more thing is it is not a good idea to have upper case letters in filenames as some servers are case sensitive and others are not and PHP will always check the case you ask it too

hey u mentioned ur file name to be sqlConn.php and in include statement u r calling sql_Conn.php Is it a typo or may b this is the source of ur error
You need to include the file with same name... though u can create an object for that class with the name u desire

include('sqlConn.php');
	
	$sql = new sql_Conn;  // assuming the name of class in that file to be sql_Conn

This should work..

i have a class called sqlConn.php within the same directory as hiuser.php
how do i call that class.

include('sql_Conn.php');
	
	$sql = new sql_Conn;

does not work i get

Warning: include(sql_Conn.php) [function.include]: failed to open stream: No such file or directory in /Applications/MAMP/htdocs/TestSite/hiUser.php on line 10

Warning: include() [function.include]: Failed opening 'sql_Conn.php' for inclusion (include_path='.:/Applications/MAMP/bin/php5/lib/php') in /Applications/MAMP/htdocs/TestSite/hiUser.php on line 10

Fatal error: Class 'sql_Conn' not found in /Applications/MAMP/htdocs/TestSite/hiUser.php on line 12

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.