php classes

Thread Solved

Join Date: Mar 2007
Posts: 154
Reputation: mrjoli021 is an unknown quantity at this point 
Solved Threads: 0
mrjoli021 mrjoli021 is offline Offline
Junior Poster

php classes

 
0
  #1
18 Days Ago
i have a class called sqlConn.php within the same directory as hiuser.php
how do i call that class.

  1. include('sql_Conn.php');
  2.  
  3. $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
Reply With Quote Quick reply to this message  
Join Date: May 2009
Posts: 101
Reputation: leviathan185 is an unknown quantity at this point 
Solved Threads: 14
leviathan185's Avatar
leviathan185 leviathan185 is offline Offline
Junior Poster
 
0
  #2
18 Days Ago
Originally Posted by mrjoli021 View Post
i have a class called sqlConn.php within the same directory as hiuser.php
how do i call that class.

  1. include('sql_Conn.php');
  2.  
  3. $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
Last edited by leviathan185; 18 Days Ago at 6:17 pm.
@ I'm gonna live forever, or die trying.

@ A wise man once told me, in order to understand recursion, you first must understand recursion.
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 147
Reputation: venkat0904 is an unknown quantity at this point 
Solved Threads: 15
venkat0904's Avatar
venkat0904 venkat0904 is offline Offline
Junior Poster
 
0
  #3
18 Days Ago
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
  1. include('sqlConn.php');
  2.  
  3. $sql = new sql_Conn; // assuming the name of class in that file to be sql_Conn
This should work..


Originally Posted by mrjoli021 View Post
i have a class called sqlConn.php within the same directory as hiuser.php
how do i call that class.

  1. include('sql_Conn.php');
  2.  
  3. $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
Last edited by venkat0904; 18 Days Ago at 1:26 am.
Gimme reputation points if u find my post helpful.
use [code] tags wherever applicable
dont start a new thread unless u cant find the topic already on forum.
mark a thread "solved" as soon as u get a solution
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC