Hi guys.
I am currently in the process of reading a php book and along the way I have stumbled across some things I need help understanding (listed below).
1) In the book I am reading, I have been learning about the 'command line tool' to communicate with MYSQL. In the book it states:
If you don ’ t fancy typing all these lines directly into the MySQL command - line tool, you can create a text
file — say, book_club.sql and enter the lines in there. Save the file in the same folder as you run the MySQL command - line tool from.
The thing is, I have tried to find the location of the 'command line tool' application on my computer, and to no avail. I use a laptop pc and my operating system is windows 7.
Do you know how I can find the location of the 'command line tool' so I can store an sql file from that same location, like it states in the above extract?
2) In the book I am reading, I came across the following extract:
PRIMARY KEY (memberId, pageUrl)
This was at the bottom of an sql 'create table' command.
The thing is, I was led to believe that you can only specify 'one' primary key per table.
Does the above mean that the two columns: 'memberId' and 'pageUrl' will, combined, make up one primary key?
3) Below is another extract from the book I am reading:
username VARCHAR(30) BINARY NOT NULL UNIQUE,
This is just simply a declaration of a column in a table I have been studying in the book I am reading.
I am aware of what 'BINARY' and 'UNIQUE' are for (in this context). In the book it states that using BINARY (above) will cause the field to be case-sensitive. The thing I need to ask is: surely 'UNIQUE' on its own would be enough to render the field case-sensitive? Or is UNIQUE not case sensitive? As, it doesn't actually say anything in the book.
4) In the book I am reading, there is an extract that states:
In a live server environment, you should store the file containing your database username and password
outside your document root folder, if possible, to avoid any chance of the username and password being
viewed by a visitor to the site.
How on earth could you store something outside your document root folder on a live server? Surely everything regarding your website needs to be in there in order for everything to work?
5) In the book I am reading, I have been studying some code, which builds an application. And the application makes great use of 'require_once()' because there are some class files (in the application) that are common to a lot of the files that make up the application. Obviously, this saves duplicating code over and over. Now to explain what it is I am unsure of - Some of the documents will use 'require_once()' on one file, and that file will use require once on another file. This 'top level' document will then be able to access the document that is required by the document it is requiring. But for some reason it seems like you can only take this so far.
Analyzing the code in my book, it seems like you cannot require something that requires something, that requires something.
If you do this, the top level cannot seem to access the bottom level (if you understand what I mean).
It seems like you can only go as far as 2 levels before require_once loses its effect and you have to use 'require_once()' again to include the bottommost file.
Am I correct in thinking this?
Paul.