To mission:
It's covered by the section on numeric permissions.
Ah, I see it now. Are you sure I should go with 0600 and not 0700? It seems like what I'm trying to do is read the password.php file and then execute the method getUserPassword() to return the password from it, so I would need execution privileges in that case?
Are you sure you want the `name` and `description` columns to hold similar data?
It's the only way I know how to separate the two entities, so no, I'm not really sure, I'm just unaware of any other methods.
Perhaps it would be best if I explained what I am trying to do:
I want to start out with three systems (tables). The first is a list (so only one column "userName") of usernames (2 million of them that I already have). I'm hoping the size of the list won't slow anything down too much, I'm still unsure how exactly to get the names into the database at the moment since I haven't researched that yet, and the names are all stored in text files on my computer. The usernames have characters 0-9, a-z and - in them only (so a byte for byte comparison shouldn't be a problem there).
The second table will have three fields: 'userName', 'description' and 'keyWords'. Each of these fields is a string, and description and keyWords is pretty much unlimited for what kinds of characters may appear. This table is mostly for users who want to enter their own info, I currently have about 400 users lined up for this table, so I don't expect storage space to be too much of a problem here.
The third table is a stats list (data from the user's profile page). So things like #posts, #pictures, #profileVisits, as well as userType ('Artist', 'Programmer'... though these titles are fixed [there are only about 200 possible titles], so I was thinking of assigning the title a number to save space in the database), and tagLine (a short exclamation in string format), location, gender, userType (Admin, Mod, Standard), among others (i can list all the fields if that would help). This table is here to provide the data used to sort the users by (though they can also be sorted by username).
So this is the backend, the front end is a Flash application that you can enter in a search string ("bob alice") and choose which fields to search through (any combination of username, description, key words, tag line), then you can remove users from the results (so you will only see users from one location, of one gender, one category, or one userType) then you can sort the results by #posts, #profileViews, etc and finally you will have the option to reverse the results list (so people with the least number of posts come upfirst rather than last -- although I was thinking of limiting the number of results returned to 1000 like Google since I have a limited amount of bandwidth).
From that last paragraph, I have a couple questions if I may: I am curious if there is a way to only return 50 results from a query at a time. So a user can search for 'bob', see the results page in the Flash app, but only 50 results will be sent at a time to reduce bandwidth (so when they get the 40th record or so, the app will send out a signal to the PHP file to retrieve the next 50 results). The other problem with that strategy of 50 results at a time that concerns me is processing power. I plan to have many users accessing this database at once, so that already is a strain (I suppose) if they are searching 2 million users. However, I am worried about how to store PHP info temporarily without sending it to the user. If I have the PHP file search the database and get the first 1000 results, then only send the first 50 to the user, when the user asks for the next 50 results, I would rather have the 1000 results stored temporarily somewhere so that the user is not forced to wait for the database query to execute again (in order to find the same set of 1000 users, but this time return users 51-100).
Also, I'm not entirely sure, but if I want to find the users with the least number of posts first, should I use 'DESC'?
PHP:
SELECT * FROM users
WHERE (name LIKE '%bob%' OR description LIKE '%bob%')
AND (name LIKE '%alice%' OR description LIKE '%alice%')
ORDER BY posts DESC
Awesome, thank you very much your code is very strightfoward.
Literals (e.g. "foo", 42) are different from constants.
Ah. So I should define the variable $password and then assign it the literal "password"? I'm curious if this distinction is pertinent if I am using the 0600 or 0700 permission to restrict access already.
To xav0989:
Thank you, I'll peruse w3schools as well, it appears very well organized from the first run though.
To
xadrieth:
they are used for OOP style of programing.
Ah, funny there should be two completely different ways of doing something like this.
I would also say to pick up a good PHP/MySQL book, like Web Development 4th ed. from Sams.
Thank you, I will try to stop by my local bookstore soon to see what they have in stock.
procedural style might be better if your first learning how to code PHP.
Yeah, I think I'll try to stick to procedural style where I can because it makes more sense in my mind.