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

"The Doctor" I need your help with javascript functions

This answer was rated:

"The Doctor" I need your help with javascript functions I need to validate two forms the same that we did the last time. Also I need help with mysql using cmd. I have created the tables but I allways get warnings and the out put is coming out scramble.
Hello again! Thank you for requesting me.

Please send all details. You can upload files to

Once uploaded, you will be given a link on the right. Click on the 'Copy Link' option and then paste it here.

Thank you
Customer: replied 3 years ago.


Task #1 in the Javascript is done

Thank you,

By when do you need this?
Customer: replied 3 years ago.

I have unit tomorrow 10PM If you need to see the screenshots of the tables let me know.

Hello again,

I am not certain I understand what you want me to do with the Database part. Why would I want screenshots of tables?

What is it you are wanting me to do?
Customer: replied 3 years ago.

I need my work to be reviewed by you in order to find where is my error or if it is software problem or I need you to create the tables and so on.

Send me screenshots of whatever you have and why you think there is an error.
Customer: replied 3 years ago.


For mysql lab

The issue is that you are using not null with no default. See that it says that null is not allowed but the default is null. So when you specify an insert into 4 out of 17 columns, that leaves 13 columns with a default value of null even though null is not allowed.

Using not null is good practice, but you should set a valid default. For instance:

pool_available VARCHAR(20) NOT NULL DEFAULT '',

You see there that the default is an empty string. That is not the same thing as null. If you had the default as an empty string, you would receive no warnings. It is slightly disturbing that your instructor couldn't spot that issue. It's rather rudimentary.

You can drop your table and recreate it, or you can alter the columns. For instance:


And if you would like your selects to output better at the command line, instead of ending them with a semicolon, end them with \G

Alright, beyond that, I just need to work on the JavaScript part?
Customer: replied 3 years ago.

I will try to fix it using default. I will let you know. I know this lab will separte so I will pay you separate. But let me see if I can fix it.

Well, that is the issue and correct defaults would fix it. I will contact you about the JavaScript part.
Customer: replied 3 years ago.

I trying to use default using ALTER TABLE .... but it does not want to accept it. Do I need to insert some values between '', like default 'unknown' or 'o'.

One moment please
It is possible that it doesn't like it because you already have data in the database.

So do these queries first, for each row:

UPDATE TABLE offer1 SET name = '' WHERE name IS NULL;



If you run into errors, take a screenshot and show me. Thank you
Customer: replied 3 years ago.

I tried and got error see below link. But I think is better to drop the table and start a new one. But it is dinner time I would check your response later.

Well, you didn't enter the SQL correctly. You should be using ALTER TABLE for the alter table statement that I sent you.

And in the second one, it appears you are entering bad data as well. You should type in the queries as I sent them to you.


Are you running this on a local server on your computer?


Also, are you required to use CMD? You can't use MySQL Workbench?

Customer: replied 3 years ago.

Yes I am required to use CMD. I am running this on a local server, Apache.installed in a external usb drive.

I can work on your database for you.

Go to your mysql bin directory and type:

mysqldump -p -u root database_name > dbdump.sql

Replace database name with the actual database name.

Then send me the dbdump.sql file.
Customer: replied 3 years ago.




I hope I did it correct.

Customer: replied 3 years ago.

It is very important that the database works because it will be used in connection with other files that we are doing. I so frustrated with it because if I miss something I have to start all over again. I wish I could use something more friendly and easy to edit, copy , paste etc.

You dumped a database called mlopez which has no tables in it according to the dump file. Is that the right database?
Customer: replied 3 years ago.

Yeah, I dropped the previous tables due to many errors and warnings. You may do table offer1 and request1 again based on the instructions.


Alright. I will contact you once everything is complete.
Customer: replied 3 years ago.


This document has the suggestions from the Prof. based on what we did the last week. I disagree with part of his comments because the lab instructions did not specify what items I needed to include in the forms. Now, it starts to make sense because this week we need to work on the forms items which are the same for the database lab. Remember that for this week I do not have to do all the project instructions attached. I am sending this to you just for adding the missing items to the forms and some javascript to validate the information input.

Well, I'm glad your instructor seems more pleased.
Hello again!

You can download the completed assignments here:

The database.docx file contains all of the required SQL and screenshots for your database assignment.

The mlopez.sql file is an sql dump so that you can import it into your database. Make sure that you have an mlopez database and that it has no tables in it. Then you import it by place this file into the same directory as your mysql and running:

mysql -u root mlopez < mlopez.sql

This will create the tables and insert the data for you.

For the other assignment, the check. js contains the JavaScript for the form validation. The contains all of the files for the project. And the JavaScript.docx contains the code and screenshots for that assignment.

Everything should be ready for you to turn in. Let me know if you have any questions. I'm here to help.

Please remember to rate my answer. Thank you so much!

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

Thanks for your prompt reply. I will follow your instructions and let you if I have any problems. Please check rating and make your that you get pay.

Hello again!

Yes, I received your rating. I am very grateful. You are an excellent customer.

Please let me know if you have any follow-up question.

Thank you
Customer: replied 3 years ago.

Yes I do in case the Professor ask me questions. What I put in Bold is the part that I do not understand.


<script src="DANGEROUS URL REMOVED" type="text/javascript"></script> Is this statement connect the check.js with the other php pages?


<input type="checkbox" name="am[]" id="gym" value="gym" />

Is this name something special or you just like it?

The webpages work very nice, thanks


I still have not checked the databe, let you know.


The script part is an external JavaScript file, just like an external CSS file. Because the same JavaScript code is used in both Offer and Request, it would be extremely bad form to place the code in the HTML files. The HTML files should share the code in one external file.

That name is XXXXX XXXXX it MUST have the open/close brackets. This is required for PHP. This will allow us to loop through the am array once the form is submitted to the PHP form. That way, we can very quickly and easily tell which amenities have been selected.
Customer: replied 3 years ago.


I moved the .sql file to my xampp\mysql\bin, but it does not show tables see screenshots.


From looking at the screenshots, the import did not work. Try running it without the p option. Run it exactly as I gave it to you. Also,make certain the file is in the same directory as mysql.exe.

When I run the command it works. If you get that long list of mysql options, then it didn't work. You only get that when it cannot figure out what you are trying to do.

If you cannot get the file imported, then take note that all of the required SQL is in the word document for that assignment. You could simply run the queries yourself. Just make sure you type them in correctly.

All of the queries are accurate, shop if you get a syntax error, check you typing. Odds are that you have a typo

Thank you again.
Customer: replied 3 years ago.

Just to give you an update. I tried without -p but it did not take because I have a password. So, I created the tables following your statements. It worked fine. I was afraid to use double so I entered varchar and tinyint for everything. Maybe you know the answer to these issues that I still have. When I do for instance, SELECT * FROM offer; I get a scrambled table and the Prof told me that they will look perfect as soon as we implement PHP to the tables. I noticed that your tables display vertically with no grids or boxes. How do you make that happen? Because you used \G insead of ;? Going back to javascript, can you give me a brief explanation of this part: if(!1) { 1=3 } and .trim(e.val()). Thank You and I am sorry for asking too many questions . I will contact you soon for the next part that is due next Monday. Thanks God I do not have take another class in web development.

Hello again,

How the output from MySQL looks in CMD has absolutely nothing whatsoever to do with PHP. Not even remotely. Command-line MySQL will always look "scrambled" if the length of the columns to be displayed from a select is wider than the command window. It automatically wraps everything, which results in a "scrambled" display. PHP has nothing to do with MySQL command line. PHP is used to create web site. It will look fine once you use PHP because the data will be pulled from the database and displayed on a web page using HTML elements and formatted any way that you want.

When using command-line MySQL, you have the option of ending your select statements with \G instead of a semicolon. This tells it to display the result vertically rather than horizontally. This option exists so that you can get results that have too many columns to display vertically and still be readable.

That JavaScript function takes a passed in argument of l (lower case L), which is the length that we are testing for. The default is three, as per the instructions. If no length is passed into the function, then it is set to 3. When checking the bedrooms fields, we pass in 1 because that fields should allow a single character. Otherwise, the site would not allow apartments with fewer than 100 bedrooms.

e is a reference to one of the elements (which ever is currently being passed into the function). .val() gets the value of the element (i.e., whatever you type into the form fields). $.trim (the dollar sign is important), trims off any extra white space from the beginning and the end of the string. That way, if a user attempts to enter a bunch of spaces, that will not pass the check. If we did not trim, then the spaces would be counted as valid characters.
By the way, changing the doubles to VARCHAR is an extremely bad thing to do. Very, very, very bad. It will mess up your site later and, if I were your instructor, you would lose major points. We are talking about money, which is a real number. A number is XXXXX completely different than a character field.

Let's say that you have an apartment that is $800 and an apartment that is $1000 and we want to sort the list in the web site by the rent price.

If you sort that field and it is a var char, here is the order:


If you sort it and it is a double, here is the order:


Also, if it is a real number, then you can do a search with between. So, if a user enters a range while searching for an apartment, we can easily sear for:

WHERE rent BETWEEN 900 and 1500

Since you made it a character field instead, we cannot do that. It is no longer a number so doing anything number-based on the field will stop working. You won't be able to sort by rent correctly, or search within a range.

You cannot use VARCHAR for everything. Different data types are handled differently. If you use VARCHAR for the date fields, for instance, you will no longer be able to query the database for items within a certain date range. You will pretty much make your site completely non-functional when you get to the point of actually adding the database to the site.
Customer: replied 3 years ago.

I agree with you. Can I do the changes without creating more conflicts in the tables?. I think this coming week that we have to do PHP we need to make these connections. Thanks again, I am learning a lot from you.

I'm not sure what you are referring to by "changes". The database should be implemented exactly as I sent it to you. That way, the site will have the various database-level numeric functionalities when it is integrated with the web site.

Doubles are very easy to understand. They contain numbers and only numbers, with decimal places. You cannot put dollar signs or anything like that.

The two length values are:

Total number of digits
Number of digits to the right of the decimal place

So, when you see DOUBLE(8,2), that means that it can be an eight digit number, two of which are to the right of the decimal point. So it is a field that can hold a number with a max of six significant digits and two decimal values. The max value would be:

Customer: replied 3 years ago.

What I meant with "changes" was to put the table exactly the way that you gave it to me. Although it is already created.

You could just drop it and recreate it. Changing it would likely be more bothersome.
Customer: replied 3 years ago.

I am sorry to disturb you. But it appears that you did not get another message that I sent you yesterday. The Prof is asking me to submit the jquery codes that I used. Did we use any jquery on the web pages? Otherwise, I do not know that he is talking about. I want to make sure before I open my mouth. Maybe tomorrow I will send you the PHP Lab that is due Sunday night unless he changes the date.

Your previous message was not posted.

The check. js file contains your jQuery code.
Customer: replied 3 years ago.

Thanks, XXXXX XXXXX get check.js file so I guess I need to talk to him because he took points from the HW.

Tell him that if he bothers to look in check. js, he will see that it is written using jQuery. You put your jQuery into an external file because it is used for both the request and the offer forms. Placing code that is reused in multiple form inline would be extremely poor form.

Point out these items:





All of that is jQuery. And it is good jQuery.

Can you tell me exactly what the instructor's comments about the jQuery were?


Perhaps he was referring to the jQuery library? I don't see why he would be. Your project links to the latest jQuery library. The jQuery library itself is not in your project folders. However, your check. js is written using jQuery. Many professional web sites link out to jQuery rather than having a static document in the web directory. But you can also include it locally as a static file. If that is what he wants, then download this copy of the project:




I don't think that is what he is referring to, as it really makes no difference. The check. js is written using jQuery code.

Customer: replied 3 years ago.

I asked him in an eamil. He was talking about another folder that I submitted not related to your codes. But I think that he likes src=jquery-1.9.1,js which is version that we are using. Anyway, he just picky. I am going to deposit more money to start working in the task.

Hello again,

Yes, your instructors does seem infuriatingly picky.

Whenever you are ready, go ahead and enter a new question. Please remember to start it with **For TheDoctor**. Thank you.
Customer: replied 3 years ago.

Just checking with you. Some of your replies went to my aol account instead to my yahoo account. In the last reply from you the "reply to Expert" window did not show up. So I am using this one which belongs to something that we already worked. I wanted to make sure that we are not having technical difficulties with your pending reply from last night HW request.

Please reply on the question to which you are referring. I work with hundreds of individuals, so using two different accounts makes it extremely difficult for me to follow which question thread you are referring to. Go to the question you are referring to and reply there.

Thank you
Customer: replied 3 years ago.

It does not have the reply to expert window. See photo attached. I am the guy with the apartment project

Attachments are only available to registered users.

Register Here

Attachments are only available to registered users.

Register Here

Attachments are only available to registered users.

Register Here
View Full Image

Attachments are only available to registered users.

Register Here

Your image did not come through.

I just replied to you in that question.
Make sure that when you go to that question, you log into that account. You entered that question with a different, brand-new account than this one. So if you are going to that question while logged in to this account, you are not the customer on that question. You are using two different accounts.
Customer: replied 3 years ago.

the attachment is a copy of your last reply but I cannot reply because there is no reply text box. I think is because you are using my aol account. We have always used my yahoo account with no problem. Please use yahoo. Yes, I did change the name of the tables to offer1 and request1 because I had to create them again the same way that you sent them to me. I already deleted the old ones. I hope we can fix this technical problem it is very difficult for me and for you.

The reason that you do not have a reply box is because you opened a new account and you are viewing the question in a different account than you asked the question in. The account that you are using right now is not the account that asked that question. You opened a brand new account with JustAnswer and asked that question.

I cannot assist you with any issue you are having replying to the question. I do not work for JustAnswer and cannot assist you with anything to do with the site. I can tell you that you have to completely separate accounts (different logins to JustAnswer) that you are using and you did not use this one to open that question.

If you have further questions, you must contact JustAnswer support.