How JustAnswer Works:

  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.

Ask TheDoctor Your Own Question

TheDoctor, Professional w/Adv. Degree
Category: Homework
Satisfied Customers: 1757
Experience:  M.S. in Internet Information Systems
Type Your Homework Question Here...
TheDoctor is online now
A new question is answered every 9 seconds

Hi Doctor, I am enrolled in an online course "PHP and MySQL.

This answer was rated:

Hi Doctor,

I am enrolled in an online course "PHP and MySQL. I'm working on Assignment 2 and you provided the answer to someone in December 2012. I registered to join Just Answer and paid the fee to access your answer as it is locked. Would you be able to provide the answer to me?

I don't see any file number to give you, but the person's name was Terrance and you answered 100 days and 14 hours ago.

I would really appreciate your assistance as I am struggling with this course!
Hello and thank you for using JustAnswer.
Could you provide me with the URL to the question that you are referring to?
Thank you
Customer: replied 3 years ago.

Hello again,

I can work on this project for you, but I cannot give you a copy of the code from this other answer. You really wouldn't want it anyway, as you wouldn't want to turn in an assignment that a previous student had turned it. It is likely to be flagged. No two people write code exactly the same.

However, I can write this up brand new for you so that it is original work. By when is it required?
Customer: replied 3 years ago.

I agree, thank you and I would really appreciate that!


The assignment is due April 18th, but it would be beneficial to have it earlier so I can test it and be comfortable with it.

Hello again,

I will have this to you by Tomorrow (Thursday) morning.

Thank you
Customer: replied 3 years ago.

Awesome - thank you very much!

You're welcome.
Hello again!

You can download the completed project here:

All requirements have been met and all of the code is fully commented. I promise that you will receive excellent marks.

You should be aware of the requirements for running a PHP project per your course instructions. I will go over them shortly just in case.

You cannot run a PHP file locally without having the appropriate environment in place. This means that if you open a PHP file up directly in a browser, it will never work. That is not how PHP works. PHP is a server-side language and requires a server to operate. In order to do this on your local system, you must be running a PHP-Enabled Web Server and the file must be opened through a localhost address, not opened directly in the browser. This can be accomplished with tools like WAMP or XAMPP. All of this should have been covered in your course.

These tools come along with MySQL, which you obviously need in addition to the Web Server. When running, you will have access to the phpMyAdmin tool. I have included a database.sql file with all of the code that you need to create and populate your database. You need to select the SQL option within phpMyAdmin and paste the contents of the database.sql file into the text area. Alternatively, you can select the "Import" option and browser for and select the database.sql file and then click "Go".

Once you have your environment set up correctly and the files placed in your web-root directly, you will actually be able to use the project. The first course in the list is already full. So if you attempt to register one of the students in that class, you will receive a message that the student is already registered or the class is full. For instance, if you attempt to register Martin Short, student number 1000, you will receive a message that this student is already registered. If you attempt to register Ryan Gosling, student number 1004, you will receive a message that the course is full.

Now, if you go to the last course in the list and register XXXXX XXXXX, student number 1005, you will receive a message that the student has been registered successfully. If you then attempt to do it again, it will let you know that the student is already registered for the course.

If you enter a bad student number, it will let you know that the student number is XXXXX If you input a valid student number but you do not enter the student name correctly, it will let you know that the student name does not match.

In short, this project meets every single requirement.

In the file, includes/database.class.php, you will see at the time is a series of variable definitions. These are your database connection string parameters. As you can see, it is currently set to localhost with a username or root and  a blank password. If your username and password XXXXX XXXXX this is where you would update it.

Keep in mind that the studnet name is XXXXX XXXXX

Please remember to rate my answer. It is the only way that I receive credit for my time and effort. If you require more assistance, simply continue our conversation before leaving any rating.

If you have follow-up questions about the project after you have provided a positive rating, please know that you may come back to this thread and I will gladly answer any question that you have.

If you require assistance with web development or database projects in the future, please feel free to request me directly by starting your questions with **For TheDoctor**

Thank you so much for using JustAnswer.  Have a great day!
Customer: replied 3 years ago.

Thank you very much for your quick response and assignment completion! I will work with it in the next few days and weekend to make sure I understand everything and get it working. I do have XAMPP and SQL installed on my computer. I will be in touch soon.


Thanks again and have a good night!

You are very welcome. Please remember to rate my answer. Again, you may ask any follow-up questions at any time.

Thank you
Customer: replied 3 years ago.

I will remember to rate your answer - I'm looking forward to trying it out!


Thank you.

You are very welcome. Have a great night.
Hello again Nancy!

Let me know if you have has a chance to try out the site yet.

If you have any issues implementing it, just let me know. We can work on getting it set up together.
Customer: replied 3 years ago.

Good evening,


I tried the site last night and had some errors but I haven't had a lot of time to work on it. And tonight was hockey play-offs so just got home... busy times! I'll touch base with you tomorrow. I'll likely need your help.


Thank you.

Hello again,

The site is completely error-free as far as I am aware. Whenever you are available, we can use screen sharing so that I can see exactly what is going on.

Thank you
Customer: replied 3 years ago.

Yes I'm not worried about that... I just have to make sure my SQL is running properly on my computer and make the changes you suggested in your earlier message and then see where I'm at. I just haven't spent enough time on it yet.


Thank you for your help!

You are welcome. I look forward to hearing back from you.
Customer: replied 3 years ago.



Yahoo - the assignment works perfectly! I had to get MySQL running first which took me a bit of time; then adjusted the files according to your instructions and it's a beautiful thing! Thank you very much.


Now I just have to complete 2 quizzes - one this week and one the following week and the course will finally wind down.


Again I appreciate your assistance!


You need to spend $3 to view this post. Add Funds to your account and buy credits.
TheDoctor and 2 other Homework Specialists are ready to help you
Customer: replied 3 years ago.

Thank you again. If I run into any issues in April when I have to upload the files, will I be able to ask for your assistance? I doubt if I will, but just in case...


Have a great day.

Absolutely. It if it related to this project, just come back to this thread and ask.
Customer: replied 3 years ago.

Excellent - thank you!

Customer: replied 3 years ago.

Hello I'm back! I need to submit my assignment by April 18. As per our instructions, I have to post individual files so I removed the files from the 'includes' folder and put them in the same directory as the index and took out the references to the folder. It works on my computer, but when I upload the files, I receive this error:


Parse error: syntax error, unexpected T_FUNCTION, expecting ')' in /var/www/htdocs/home/nancy/include.php on line 4

I'm not understanding the second part of our instructions for uploading which is likely the problem. Here are the instructions:


"Assignment 2 is due on Thursday, April 18. When you submit the assignment, you must use PHP to create and populate your MySQL tables on the assignment server. Your access to the Apache server is the same as for Assignment 1. The MySQL server is localhost. Your MySQL username and password XXXXX the same as your Apache username and password.


You have been granted full privileges to a database that has the same name as your username. For Assignment 2, user jack who accessed with password XXXXX for Assignment 1 will have access to a database named jack at the MySQL server named localhost using username jack and password XXXXX"


I've changed the username & password XXXXX database.class, but I still get the same error.


Do I need to rename my database? Should I be asking my instructor about the instructions or can you help me with this?


Thank you for your assistance.

The project I gave you does not include code to automatically create and populate tables. You never gave me those instructions and they were not part of the instructions given by the previous question. Doing so is not a common practice with PHP. People usually create their databases using the DBMS, not PHP.

Doing so will require another script. Also, you cannot simply change the directory of the files and have them work. You would have to rewrite the include.php file. Even if you uploaded into separate folders, they are still "individual files".

So you need to rewrite include.php and you need to write a new script to create and populate the database.


You can download the altered project here:




There is a script called createTables.php


Open that file and change the username and password XXXXX the database so that it connects to your database server on your school's account.


Once uploaded, go to that file. Only go to it once. It will create the database and tables.

Customer: replied 3 years ago.

Thank you for the revised files! I uploaded the new files, inserted the username & password, then uploaded to the school account. Then I went to "createTables.php" and received this error:


Warning: mysqli_connect() [function.mysqli-connect]: (42000/1044): Access denied for user 'nancy'@'localhost' to database 'college' in /var/www/htdocs/home/nancy/createTables.php on line 15

Fatal error: Call to a member function multi_query() on a non-object in /var/www/htdocs/home/nancy/createTables.php on line 70

I'm sorry to bother you with this - I'm having trouble understanding it.

Notice in the instrucitons that it states that you have access to a database that has the same name as your username. I will assume that is "nancy"

You cannot use the database called "college". You can only use "nancy" (assuming that is your actual user name).

Download this copy of the files:

Change the password XXXXX both the createTables document and the database.class.php file.

They are now set up to use a database called "nancy".
Customer: replied 3 years ago.

Awesome - thank you so much! Yes the username they gave me is "nancy". I will try this when I get home from work today.


I appreciate your assistance!

Customer: replied 3 years ago.

Hello again. I'm sorry to bother you, but my deadline is getting close. I've made all the necessary changes as you instructed but am getting these errors. Am I supposed to change anything in the "include.php" file?


Warning: mysqli_connect() [function.mysqli-connect]: (28000/1045): Access denied for user 'root'@'localhost' (using password: YES) in /var/www/htdocs/home/nancy/database.class.php on line 12

Fatal error: Call to a member function query() on a non-object in /var/www/htdocs/home/nancy/database.class.php on line 21

My instructor sent me an email saying "include.php is trying to load Database.class.php which is not installed on the server. If you have Database.class.php on your test system, you will have to upload it and any other additional modules you used at home."


But I have uploaded all of the documents - I don't understand how to fix this issue.


Your assistance would be greatly appreciated!


Hello again, Nancy.

You do have Database.class.php installed. You see how the error is coming from database.class.php? It wouldn't say that if it wasn't installed.

The error that you are receiving is not a programming error. That error is coming from the database. It states in plain English what the error is.

The database is denying access for a user called root, who is using a password.

So it would appear that you opened the database.class.php file, changed the password, but left the user name as root instead of changing it to your user name. As I have stated previously, you need to change the username and the password XXXXX match your credentials. That file still has "root" as the user. Change it to your username instead and then upload it again.

Customer: replied 3 years ago.

This is what I have in my database.class.php and createTables.php (i removed the password XXXXX this note):


DEFINE("HOST","localhost"); //The Database host address
DEFINE("USER","nancy"); //The user name set on the database
DEFINE("PASSWORD","xxxxxx"); //The password XXXXX the database user
DEFINE("DATABASE","nancy"); //The database name


I reuploaded all of the documents and now get these errors:


Warning: include(Database.class.php) [function.include]: failed to open stream: No such file or directory in /var/www/htdocs/home/nancy/include.php on line 6

Warning: include() [function.include]: Failed opening 'Database.class.php' for inclusion (include_path='.:/usr/lib/php') in /var/www/htdocs/home/nancy/include.php on line 6

Fatal error: Class 'Database' not found in /var/www/htdocs/home/nancy/index.php on line 9

I'm sorry I'm not looking too bright - I'm still having a hard time with this course.



Now that is a completely different error. It is saying that it cannot find the file Database.class.php

Rename the file to make certain that the file has a capital D. So the file name should be Database.class.php, not database.class.php

Then upload the file and try again.
Customer: replied 3 years ago.

YAHOO it's working!!! I also had to change to Thank you so much for your help - I really appreciate it!! I'll be able to sleep tonight!


Have a good evening,


No problem. Linux-based servers are case-sensitive. Windows are not. That's my fault. I apologize. Have a good night!

Related Homework Questions