0

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

3
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by venkat0904
0

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

Edited by leviathan185: n/a

0

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

Edited by venkat0904: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.