MySQL database relation question

I'm setting up a site where registered users can catalog
their Japanese Vinyl toys (i.e. vinyl kaiju). I have 2 tables:
collection
members
members has an ID that is specific to each member
(naturally). within collection I have kaijuID and userID.
What I need to figure out is the best way to get the ID from
the member table to populate within the collection table, thus
allowing each registered user to see just their collection.
I can wrap my head around displaying the collection based on
the user ID -- I just can't figure out where to add the user ID
information into the collection database.
The site structure has:
login page
member home page
add kaiju
view kaiju
update kaiju
search kaiju
the add / view / update / search pages will all utilize the
ID's. Not a big deal since I can have the user ID as a base for the
results on these pages. it's the adding a new kaiju part that I
can't figure out. Where would this form associate the logged in
user so that it silently adds in their ID along with the toy info?
A hidden field would be a natural assumption -- would that be part
of the submit action?
So basically here's the breakdown:
User A has an ID of 001
User A wants to catalog 2 kaiju: Godzilla and Gamera
When User A submits these two each will need to have the 001
user ID added to the collection table column labeled as userID
(which is the same as the column in the member table).
Which will allow the viewed collection to specifically show
just member 001's collection.
phew. Any suggestions would be appreciated. I looked through
the CS3 documentation and got this far but didn't see anything for
relational databases.
Thanks!

tried doing that and it wasn't working. When I had added the
binding the vinyl I had added in as a test wouldn't display.
What would be ideal is the following:
all new users are assigned a userID in the MEMBERS table.
this is an auto-incrementing (primary key) value that is unique to
each user.
in the COLLECTIONS table there's a column called userID. when
a user is logged in, then any new addition to the COLLECTIONS table
will add in their userID on the backend so that each user's entries
are tied in to their userID.
I first tried adding in the session_start code on all pages
and then the filter to the recordset. rather than using filter:
user_name I went with filter: userID. That didn't do anything but
killed the display of any new additions to the view page.
I then tried setting up a binding to a hidden field in the
add form:
<input name="userID" type="hidden" value="<?php echo
$_SESSION['userID']; ?>" />
which might have been successful, although I got a message
saying that userID cannot be null, so when I switched it to NULL
the entry didn't register anything in the COLLECTION --> userID
column but a NULL.
Would part of the problem be that userID in the MEMBERS table
is the key? I already have a column in MEMBERS that is usrname --
which would be easy to change in COLLECTIONS (from userID to
usrname) although I wasn't sure if that would do anything either
way.
Also, since the session isn't labeled, such as
<?php echo $_SESSION['userID']; ?>
then how, based on your helpful suggestion, will the pages
know the specific session ID?
so close....

Similar Messages

  • How to retrive data from MYSQL database beginner question

    I need to know a method, on how to retrieve values from a MYSQL database. I finally managed to insert data to a MySql database using hibernate, with the help of google. but, i couldn't find any helpful article on google, on retrieving data, will some plzz help me, by directing me to a site that has sample codes ??
    i am actually new to MYSql and Databases in java, so plzz do help me, i am lost here,,, :(

    Oh, it's Hibernate. In the future, please use the forums at their own site.
    Answers on how to use Hibernate are usually available in the excellent "Hibernate Reference Documentation" available here.

  • Simple java/mysql database application question about triggers

    I am planning a new database application using java and mysql. I may want to use some triggers to automatically update the tables when a change is made. my question is this: If I write the trigger, and I use Java to modify the database, will java automatically pause and let the trigger finish doing its task before it continues? what if it writes more to the table before the trigger is finished modifying the table? how do I get java to pause and let the trigger finish?
    thanks for your response

    lduren wrote:
    I am planning a new database application using java and mysql. I may want to use some triggers to automatically update the tables when a change is made. my question is this: If I write the trigger, and I use Java to modify the database, will java automatically pause and let the trigger finish doing its task before it continues? what if it writes more to the table before the trigger is finished modifying the table? how do I get java to pause and let the trigger finish?
    It doesn't have anything to do with java at that point.
    When you execute, for example, an insert statement, then the database executes that statement. The database (not java, not the driver) decides with that statement is complete. Control returns to java when the database decides that execution is complete.
    And except for tricks that one might do (or attempt to do) via SQL or triggers then when the statement execution finishes then everthing has completed running.

  • I have some database related questions

    hey all
    i am currently designing a java GUI program for a dvd renting shop.
    this program obviously needs a databse, i was just wondering how much possibly a database on a home pc could hold data because this shop have about 15000 DVD title and about 1500 client so i was wondering how much a mySQL databse table could hold....
    i also have another question...this shop have an access database...my question is can i use the existing database and querie it from my java program??? do i need a driver ??? can i querie an acces databse just like a regular SQL databse(e.g. SELECT * FROM TABLENAME) ????

    hey all
    i am currently designing a java GUI program for a dvd
    renting shop.Why not simply download JBoss Seam's DVD store example. It's fully coded for you already!
    this program obviously needs a databse, i was just
    wondering how much possibly a database on a home pc
    could hold data because this shop have about 15000
    DVD title and about 1500 client so i was wondering
    how much a mySQL databse table could hold....
    You will not have issues even with Access with that few a number of rows. Disk is really the only limitation on the size of the database. (There can be O/S or database specific limitations, such as 2GB of total size). So, do not worry about how many records.
    When you truly get a large number of records (tens of millions plus) or you are joining two large tables, then you can have performance issues. Good use of primary keys, indexes and database design can limit this issue.
    i also have another question...this shop have an
    access database...my question is can i use the
    existing database and querie it from my java
    program??? do i need a driver ??? can i querie an
    acces databse just like a regular SQL databse(e.g.
    SELECT * FROM TABLENAME) ????You can use Access, mySQL, Postgres or any number of other databases. Each will require (and will have on their site) a JDBC driver that you need to have on your application's CLASSPATH. My recommendation would be mySQL or Postgres. Both are free and excellent quality.
    As an aside, you should rarely SELECT * from any table (other than a code or lookup table). Use a WHERE clause to limit results. What user would possibly want to scroll through ALL 15,000 records? :^)
    - Saish

  • MySQL Database Structure Question

    This is probably going to seem a little odd, but I need some outside opinions.  I'm using Dreamweaver CS5 to build a business website.  When all is said and done, it's going to have around 20,000 items (not anytime soon, but it'll get there).  I'm using a dynamic data set up to load the inventory because I'm way too lazy to build that many pages and links one at a time.
    The corporate chain has two sections, lighting, and electrical supply.  I want the database to hold the product ID(of course), name, description, image(this is part of where the question comes in), price, sale price(discounts not our cost), an enum field for whether or not the item is discontinued(for our own records), size / weight for shipping reasons, and if reality is permitting, a field for color selection of the products.
    My original idea was to have two tables, one for lighting, one for electrical.  Somebody pointed out to me that this could fail because they pointed out that some of the items might have multiple images, which is true.  Some of the items (like some of the fans we sell) have different colors but still cost the same.  They suggested I set the images up in a seperate table and use a foreign key. but that changes my entire structure.
    Does anyone mind offering ideas on how I might set that up to avoid data redundancy and other problems that might pop up due to repeat listings?  I've got the images all with unique names (in the case of the same product in different colors, I added a color code like pb for polished brass, etc.)  That person had an excellent point on multiple tables, so now I'm wondering about a better and more reliable structure.

    I'm ok with PHP, and usually pretty good with databases.  Right now I've got enough sample stuff to build a smaller scale prototype with about 200 products, from both lighting and electric.  Believe me, I haven't really done much more than start with the layout, because the many to many relationships just didn't occur to me.  Pretty much going solo on this project with occasional advice from one co-worker who's good at his job but extremely busy, so I think I just got a little to close to it and overlooked some clear and obvious problems.  As far as requirements, I'm using a 3 column div tag layout, the left column being the nav bar with the product categories.  When they click one of those, it should display that category (image, name, price) with the clickable name and thumbnail image in the middle, and from there they click the product they want to see and it'll display the full size image and full description on the right column.
    Set requirements...wish I had a clear list, but the bosses are pretty much illiterate in this area of computers, so I'm on my own with that.  That's all I'm hoping to get out of the database is that three column layout.  I figure I'll make a changeable nav bar later so customers can switch from one store to the other and the nav bar goes from there.
    We're hoping to get the database to have the fields I mentioned for now (at least for initial testing) and maybe add an inventory tracking function so we know how many we have throughout the chain.  We're not worried about that part now, just getting them up and selling cuz our current inventory system works just fine.  How would 10 or more tables be better?  Just breaking down the amount of products to be searched at a time, or is that how detailed you think it should be built?  Don't worry, I wasn't hanging everything on a two table set up, I knew there would be room for much improvement.
    Current basic layout:
    Lighting / Electric Tables          Image table:  ID (either the product ID without the color code or maybe the document path), category(lighting / electric),                                                                   subcategory (fan, lamp, etc)
    id
    class
    category
    description
    price
    sale price
    discontinued
    size
    weight
    That's what I've got so far, sorry for the weird way that list pasted....

  • Duplicate target database related questions

    I have several questions regarding duplicate database and please help me in understanding this process. I really appreciate it.
    1) When I look through log file of duplicate command it looks like the control file be created twice. One is after the restore and the other one is after recover. Am I right and why?
    2) What exactly this command "switch clone datafile all;" do?
    3) How to bring the other node into cluster db after clone from a single instance to one of the node in a cluster?
    Thank you very much for your help!!
    Shirley

    1) When I look through log file of duplicate command it looks like the control file be created twice. One is after the restore and the other one is after recover. Am I right and why?Creates only once. Control file creation after recovery does not make sense to me. You will have to recover again if your controlfile is recreated
    What exactly this command "switch clone datafile all;" This is like saying "Dear controlfile, please recreate it by changing all your source datafile locations to the newones mentioned in the duplicate database". For most practical scenarios, you will use DB_FILE_NAME_CONVERT that will map source database file locations to the new file locations for the duplicate database.
    How to bring the other node into cluster db after clone from a single instance to one of the node in a cluster?Just use a "single instance to RAC conversion" method. Once a duplicate database is created it can be used like any other database.
    Message was edited by:
    Srinivas.R

  • Database related question

    Hey all Experts out here,
    I'm writing a situation here and i want the best solution available for that. I have to read some backup tables(around 15). Modify some Data in those tables(based upon certain conditions) and then insert that data to original table.
    Heres the solution I'm thinking off.
    Read Data from Backup table and save each row as a HashMap and All rows in a ArrayList.
    Iterate through ArrayList and update the data in HashMap based on certain conditions and then extract the data from HashMap and insert it in original table.
    I know this solution is not the best one. So can you guys please suggest me the best way to do it.
    Thanks and Appreciate your time to read this.
    sam

    just to clarify I'm not sure how my solution is
    client side. it is server side. you could do it
    through whatever basic client comes with your
    database or do it through a Java program if you
    must.If you read all of the data from the RDBMS to a Java
    application, that's client side. The RDBMS is the
    server, the Java application is its client (even if
    that Java application is a server in another context).right. but I suggested...
    CREATE TABLES...
    INSERT INTO SELECT
    UPDATE
    more INSERT INTO SELECT
    DROP TABLES
    so no client side data manipulation there.. you could write a stored procedure for the whole thing.

  • Some database related Questions

    1.Why using Index improve the performance , how will the data from the database is placed in the buffer ( as we see in the table or linear as per the buffer size)??
    2. What happens when we create index for all the field, even it becomes like sequential read the performance will be improved right?
    3. When a select statement is triggered, the corresponding table will come to buffer (if it is fully buffered) and the few records as per the given where condition is extracted adn placed Where?
    4. I created a Ztable with three field numeric A , B and TOTAL and I am maintaining table maintence, so when ever i enter in SM30 field   A and B, TOTAL should be the appended automatically as the sum of a and b.whether is is possible how?
    5.What is Composite Key? with a real time example?
    regards,
    Prabhu
    POINTS ASSURED.

    hi
    when creating table primary key creates automatically
    secondary index to be create according to user requirement
    to resolve u r doubt simply create a select statement with where condition with non primary key field it wont fetch data if u create secondary index it will fetch data
    buffered tables will be placed in apllication server ram
    compositekey means combination of two primary keys
    reward if u fin useful
    regards
    Nagesh .Paruchuri

  • Database setup with MySQL and PHP question

    Hello all,
    I recently had a problem getting a report to work for a site I was updating.  This site is written in PHP with a MySQL database.  The application is to track customer calls to auto repair stores.  The database has a lot of foreign keys because they wanted to update information in only one spot and have multiple records be updated all at once.  So, I've got all the information from individual calls saved in the call_log table, and have foreign keys to reference information in other tables (for example this table lists what store received the call referencing the store table).  If a store changes locations, they want to have reports automatically update with the new address, connection to conversation number, etc.
    In one of the responses to my question on how to get this report to work, I was told that this could be done without using foreign keys (by Normalizing the database using mapping tables).  I am still a newbie to MySQL, and after looking though a lot of manuals, tutorials, and forum posts, I am more confused now than ever.
    I got the report to work using the foreign keys, but I would like to learn what I should have done with the database (and how to get the information displayed).
    So for example one report would be displaying the following:
               Store                                                      Reason for the Customer Call
                                               breaks             oil change            shocks              tune up         total calls
    5636 - Bloomington                  2                       4                        0                       2                   8
    8875 - Duluth                           1                       6                       4                        8                  19
    with links on the store name to pull up the information on that specific store.  How would I change the database (listed below) to do this without foreign keys?  Any help would be greatly appreciated.
    call_log             (table that contains the following:)
    call_id
    conv_number
    date
    camp_type         (foreign key to the campaign table so it displays the campaign_id)
    reason               (foreign key to the call_reason table so it displays the reason_id)
    location              (foreign key to the store table so it displays the store_id)
    associate
    call_summary
    trainig_issue      (foreign key to the training_points table so it displays the training_key_id)
    visit_closed
    example            (foreign key to the example_type table so it displays the example_id)
    campaign          (table that contains the following:)
    campaign_id
    campaign_name
    campaign_promotion
    campaign_coupon
    campaign_startdate
    campaign_enddate
    call_reason       (table that contains the following:)
    reason_id
    reason
    store               (table that contains the following:)
    store_id
    store_number
    store_address
    store_city
    store_state
    store_postalcode
    store_name
    store_phone
    store_email
    store_mgr
    training_points  (table that contains the following:)
    training_key_id
    key_issue
    policy
    example_type  (table that contains the following:)
    example_id
    example_name
    example_image
    Thank you very much.

    Frankly, that is way to much of a question to be answered in detail on a forum... There's a lot involved and a lot of general database understanding required. I would highly recommend:
    Database Design for Mere Mortals:                       A Hands-On Guide to Relational Database Design, Second                       Edition -- by Michael                     J. Hernandez
    This is an invaluable book to get you going in the right direction and on a firm foundation.
    Lawrence   *Adobe Community Expert*
    www.Cartweaver.com
    Complete Shopping Cart Application for
    Dreamweaver, available in ASP, PHP and CF
    www.twitter.com/LawrenceCramer

  • Mysql database question

    Let's say that I am making a java program that connects to a Mysql database and uses the database "MyDatabase".
    Forgive me, but I am relating this to a Microsoft Access database.
    The database is not on a network, but is (or will be installed) on the user's machine. In otherwords, the database will be on the user's machine and the changes to the database will only affect that user.
    If I am to let a user use this program, will they have to also have Mysql installed for the program to access the database and pull information from it?
    --Thanks!                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                

    Let's say that I am making a java program that
    connects to a Mysql database and uses the database
    "MyDatabase".[snip]
    The database is not on a network, but is (or will be
    installed) on the user's machine.[snip]
    If I am to let a user use this program, will theyhave
    to also have Mysql installed for the program toaccess
    the database and pull information from it?Yes.
    (if you are asking if the code could directly
    access/manipulate MySQL datafiles without going
    through the MySQL program, I suppose in theory you
    could, but I seriously doubt you really want to)The reason being is that it would be a client database for their own use, as oppose to sharing the database with others.
    In any case, Thanks!
    Next question: is there any place where I could go to find code that would treat the Mysql database as a client database (so far, the code that I found requires Mysql to be installed and running in the background on the user's machine)?

  • Is the MySQL a Relational Database?

    Is the MySQL a relational database?

    MySQL uses several different storage engines to
    manage the data in tables, and the choice of storage
    engine determines the capability of the table. These
    are MyISAM, MERGE, InnoDB, BDB, and HEAP or Memory.
    Each has ramifications regarding queries and data
    a storage. The BDB storage engine is available with
    the *max version of mysql.
    By default, tables created in MySQL with a standard
    CREATE TABLE statement use the MyISAM storage engine,
    which does not support foreign keys or transactions.THERE'S my problem: I'm too cheap to use anything other than the free download. 8)
    I wonder how many folks KNOW that the free one doesn't support referential integrity and use it anyway? The LAMP platform gets a LOT of play because it's "free".
    InnoDB supports transactions with full ACID
    D compliance, auto-recovery following a crash of the
    MySQL server, foreign keys and referential integrity
    with cascading deletes and updates. Query contention
    is managed with row level locking, rather than table
    level locking with MyISAM.Thank you so much for the info. Sincerely, %

  • Java application- database related concept question

    hi Friends,
    I have 2 concept related questions,can someone please help me on how to implement them.I am making a java-based VOTING application.First thing,I am making a generic application,so I
    don't know how many contestants would be there in each contest.
    So,how can I design my database table??Should I try to create a database table on the fly,depending upon how many contestant are there to participitate??
    Secondly,if somebody sends a vote like "contest_name contestant_name",I want to increment the counter of that particular person by one.So,should i have a separate database table,with the
    name of all the contestant and their repective counters.What if somebody sends a wrong contestant name,do i need to query the database for that too,or i can store beforehand all the contestant names in the session or somewhere else.........please help
    Thanks

    Layer 4.

  • Question:How to use MySQL database as a service in Oracle Cloud

    Hello All,
    I want to use MySQL as backend for my application.How can i select MySQL database.Its showing me only to choose Oracle database.
    Thanks in advance.

    The Oracle Database Cloud Service uses the Oracle Database.  You do not have access to the underlying operating system to make the choice you are seeking.
    When the Oracle Compute Service comes out later this year, you could use one of those "infrastructure only" environments and load MySQL into it.  You would be responsible for all maintenance of MySQL and the environment.
    Hope this helps.
    - Rick Greenwald

  • How to get data into the mySQL database?

    First some background.
    I have a website that has outgrown its designed dimensions and is a huge burden to maintain. See PPBM5 Benchmark
    There is a lot of maintenance work involved, so I'm investigating a PHP/MySQL approach to easen the burden and to add functionality to the site. With the current Excel based structure and over 420 entries, it is cumbersome for me to maintain, but also for users to find what they need.
    A MySQL based dynamic structure is a lot easier and offers vastly more selection capabilities, like selecting only records that meet specific criteria.
    Data submission is done with a form, that contains most of the relevant data, but the drawack is that people submitting their data are often not technically inclined, give wrong answers due to a lack of understanding or making typo's. The test results are attached in one or two separate .txt files, but often they have not read the instructions correctly or did something wrong, so these attached .txt files can not be trusted automatically, they have to be checked before inclusion.
    These were my initial thoughts:
    1. Data collection:
    To avoid spending all our energy and time  on correcting typo's, getting missing data, correcting errors, I am  investigating the use of CPU-Z in Ghost mode to create a .txt or .html  file that contains all relevant hardware info we need and even more. It gives all the info we currently have, but adds  data like number of memory sticks, DDR timings, stock clock speed and  BCLK setting, video card info and VRAM size, etc.
    To see what I mean, run CPU-Z, go to the About tab and press the Save Report button and look at the results.
    This can all be done without user intervention in an automatic way, but  maybe I need to add an Auto-It file to the test to make it all run as  desired.
    If this works and I'm able to extract the relevant data from the created  file and can insert it into the database, we may be in business for the  next version of PPBM5.5 or PPBM6. It does require a modification to the instructions, making them a lot  easier, because there is less data to fill out.
    2. Data submission:
    The submission form can be simplified if  the CPU-Z data can be used. We have to create an automatic way to attach  the created .html file from CPU-Z to the submission form and we have to  streamline the Output.txt and Output-MPE.txt files to be more easily included in the 'form.lib.php' file. It  currently is manual labor and very time consuming.
    3. Adding to Database:
    I have to find a way to create database  records from the Gmail forms I receive. All incoming mail messages need  to be checked on relevancy and if relevant, need to be added  automatically to the database and then offered for approval before final inclusion in the database. Data included in the database  will then include submission date and time, Email address,  IP address  used, plus links to the files submitted and available on the website.
    4. Publication of the database:
    After approval of new records from step  3, all updates will be automatically applied to the database and  accessible for users. I do not yet intend to introduce a user account ,  requesting login before all functionality is accessible. Too much trouble and administration.
    Queries should be possible on things like CPU (check box), so include  17-920, i7-930, i7-950 but exclude i7-980X and i7-990X, Size of memory  (check box), Overclocked (boolean, yes, no), SSD as OS disk, and similar  options.
    The biggest problem is to keep the color grading and statistical  indicators (Top, D9, Q3, Med, Q1 and D1) intact on dynamically generated  queries. Say you make a query which results in 20 observations, this  should show the related colors and legends. Next query results in 48 observations and of course the color grading and legends  do need to reflect that. Question in my mind, does the RPI remain  constant, independent of the query or does that need to be recalculated  on the basis of the query?
    Next thing is to allow a user to select a specific observation and by  simply clicking on it be shown, in a separate window (detail page) or  accordion, all the CPU-Z related information about the hardware.
    The graphs, Top-20 and MPE Gains, need to be dynamically adjusted, based on the query used.
    5. Ideally, external links:
    In an ideal situation, one could link the  CPU-Z data to external price databases, looking up current prices for  CPU, memory, video card, disks, raid controller, etc. to get instant  BFTB charts, based on the query made. But that is the next step.
    Situation now:
    I have a MySQL database that is easily updated with the new submissions. Simply create a .CSV flie from the submitted forms and import that into the database. The bulk of the initial work is done.Lots remain to be done as you can see above, but that is for a later time.
    Question:
    I have this table, that needs to be filled with data in the submitted and attached files. Mr. X submitted his data and can be uniquely identified by his "Ref_ID". He attached one or two files in .TXT format with the relevant test data. These files are stored on the server with a concatenated name:
    "Ref_ID","-","filename"
    Say his Ref-ID is: 20110204-6cf5 and his submitted file is called: Output(99).txt then the file can be found on the server as
    20110204-6cf5-Output(99).txt
    I need to be able to open that comma delimited file, the contents may look like this: "439","1036","819","531" and insert these contents into the relevant record and fields.
    Graphically,
    is what I want to achieve.
    This being my first exposure to PHP/MySQL, you can imagine I'm not clear on how to go from here.
    Added complication is that I actually have 5 numbers to insert per record and two calculated fields, Total Score and RPI should be calculated fields. Haven't yet figured out how to handle calculated fields, maybe only in the PHP/HTML code and not in the database.
    I hope someone can help me.

    You do have a very complex looking site and may need several tables in mysql to handle all that data. If you knew to phpmysql I would suggest taking a look at this tutorial it will help get you started in understanding how to $_GET info from a database and also how to $_POST data to a database. I am no expert just learning myself and I found this very helpful. This is the link http://www.adobe.com/devnet/dreamweaver/articles/first_dynamic_site_pt1.html
    There are also many tutorials on Youtube to help build a CMS Content Management Site I would suggest the following: -
    http://www.youtube.com/user/phpacademy
    http://www.youtube.com/user/betterphp
    http://www.youtube.com/user/flashbuilding
    And many more on my channel here
    http://www.youtube.com/user/Whisperingonthewind
    CMS's are easier to maintain, add edit and delete content.
    I have also recently bought a Book by David Powers Training from the Source very helpful.
    Anyway hope you get it sorted.

  • How can I configure a mysql-database for new cms install?

    I just install a mac os x server on os x 10.8.4, but can't create a database to install a cms, how can I do this ? How cann I access the database from admin window or else ?

    Consider acquiring some external hosting as part of your efforts, then?  Various folks offer this hosting, and that gets you out of maintaining (most of) MySQL and Drupal, and more time to spend on your web site and whatever else you're working on.
    As for your questions, please follow the installation instructions for installing MySQL, then follow the instructions for installing Drupal.  The OS X Server setup is basically the same as any other Unix system, too; what you're doing on Ubuntu is more or less the same as what you're doing on other Linux and Unix systems, and on OS X and OS X Server.  (This is also at the core of why most of these add-on widgets expect you to set up your PATH, too.)
    The Drupal database connections are managed under the sites directory, a subdirectory located within the Drupal directory tree.  You'll find subdirectories for the specific Drupal sites you've configured there, with a settings.php file for each.  There's also a general sites directory with modules and themes that can be applied generically.  The settings.php file itself can be edited with nano, vim or emacs via the command line, or with one of a very few ASCII-capable GUI editors.  If you don't know what I'm referring to here, use nano editor.
    Yes, you can install phpmyadmin on OS X.  I wouldn't, though.  Sequel Pro has a much more familiar interface for folks that use OS X, and you don't have to protect that tool quite like you have to protect and maintain phpmyadmin against attack.  Do not allow remote access to phpmyadmin, as ill-secured sites are a popular target for remote attacks.
    The Drupal web forums are a pretty good resource for Drupal-related questions, too.

Maybe you are looking for