Uploader Comments (JREAMdesign)
All Comments (10)
-
@JREAMdesign Never mind. For everyone following along, make sure you surround the values in the ini file with double quotes. I was pulling my hair out because I was using single ( ' ') quotes.
-
@JREAMdesign Ok, I fixed the problem with the extends problem -- it needed an 'include_once DatabaseProperties in my Database class --, but now it won't connect to my database unless I put all the values directly in mysqli_connect method. Basically it's not getting the required info from DatabaseProperties class which is parsing the .ini file. My code looks exactly like users so I don't know what gives. Any help would be greatly appreciated.
-
I stripped down my code to just a basic class with a _construct then echo 'hello'; and while eclipse is showing these pieces are put together properly, when I create an index with include 'Database.php' then invoke the constructor $db = new Database(); and navigate to that directory with the index and classes in my browser the screen is blank. No error no nothing. What gives? Is there a set up problem or something?
-
Fatal error: Class 'DatabaseProperties' not found in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\vi
deo_dating\includes\Database.p hp on line 3 I put all the files in one directory and called it 'includes' I created an index and tried declaring my new Database object. Line 3 happens to be the include statement: include 'Database.php';
I'm using Eclipse and my file structure looks like: (root being htdocs)
root/projectfolder/index.php
root/projectfolder/includes/allclasses.php
root/projectfolder/adminpage.
My question: can i use include $_SERVER[DOCUMENT_ROOT]. 'file path to classes folder'; to set up the link then just create my objects as usual? I'm new to OOD. thx
wrdeboise 1 year ago
@wrdeboise You should be able to do that just fine! I cant remember exactly what i said in this tutorial, but if it was about "autoloading", then at some point you will wanna autoload, saves time :)
JREAMdesign 1 year ago
I have a question, in index.php wouldn't I have to include DatabaseProperties.php and Database.php. Why not include DatabaseProperties.php inside of Database.php. Otherwise after you have all these classes that you have to include on all these different files/pages. Am I right or am I wrong? I think I'm just missing something. Anyway thanks for the video you should keep making them.
XtronGraphics 1 year ago
@XtronGraphics Heya, I mentioned in the comments I forgot to autoload or include if you saw that :P -- Well the reason I personally don't think you should do the include through the class php file is because at some point you are going to want to autoload() all your classes, and those can only be class files. A class should be standalone and not interfere with the flow of loading. When you separate components it makes your application really easy to work with later on and if you re'use it :)
JREAMdesign 1 year ago
your videos are awesome. It would be cool to see how you would approach creating a website witth OOP. I have been trying to figure out the best way, but always resort to procedural programming. I like OOP better though
divac7777 1 year ago
@divac7777 Hiya, I'm not sure what kind of website you want to make, because for a regular website I would just use a pre-built CMS such as WordPress, or FrogCMS. It sounds like you want more of an "Application Website". Procedural programming isn't bad, but it's hard to explain everything in 10 minutes or a short comment, and I don't know everything, haha. Well I hope some videos will be able to help I do them once in a while!
JREAMdesign 1 year ago