Class Notes – Building web database

Step 1 – Create Table

- phpmyadmin – www.imagearts.ryerson.ca/jpascoe/myadmin/

- select your database

- select table to work on – if it exists

- if not -create it:

- will lilst all tables that database already contains

- at bottom of list – option to create new table

- can modify inClass2 or start from scratch

- table name – describes contents

- number of fields: (may not know exactly, but should have fairly good idea) – figure out what info you need before you get to this point

- can add and remove at will, but be careful when removing

- Dublin Core – 15 fields

- click go – it will show you big table

- first one/field – put in primary key – My Table_ID – always INT (integer) – name by convention is your table with ID at the end . Type is always INT. No need to enter values, except under:

- Extra – auto_increment.

- column immediately to the right, click the button, makes the row primary key (called primary)

- primary key – field in a record that guarantees its unique, has to be unique.

- if the object has accession number and it is guaranteed as unique, then it can be used as primary key.

- CHAR – fixed length, VARChar – variable length up to a maximum

- 2nd Field: Author – make sure you set the length to a length that you know the authors name will stay within (max 255 – char), space is a character, if over limit, it will cut off the name.100

- Make it text if you can’t guarantee the text is below 255 – take more processing power, min. amount will be too big. Only use if your sure it will be over 255. VARCHAR and char are tiny and fast data types.

- Null: not null means that field has to have a value, has to have data entered (database will reject it saying you haven’t filled in the form correctly). Null means its ok to not fill this field in. mySQL ignores this.

- Title: text

- Date: can be vague or accurate. if data is the type that you will have accurate dates – all digital images have creation date, photographs may not. Date data type constrains you – but it will allow for calculations to be done with it.

- If you can’t guarantee that dates will be in right format, then you need to use text based (VARCHAR, CHAR) – but searches where you’re actually calculating becomes trickier.

- Only have 3 or 4 options to enter date – why you use vocabularies and authorities

- Or you could just have a year field – use INT

- Date: VARCHAR 30 characters

- intYear: INT – duplicating data but allow for calculations – allows for searches in the year/dates

- Naming the fields – rules apply

- Medium – VARCHAR – 30 – predefined listing for names (authority) – make it the maximum length of those canonical names (make up list and then count the longest)

- Users will not see these field names

- caption- text (scope) – set to null, not all images have a caption

-with text you don’t have to enter value

- alt_author – varchar – 100

- order of fields doesn’t matter – queries that you ask the database that will structure responses.

- subject_person (controlled form of the person’s name) VARCHAR 100

- subject_corporation – VARCHAR 100

- subject_topic – VARCHAR 100

- location – text

- click save

- if there is something wrong, there will be red letters

- color coding based on what part of the table

- if you want to change one field – click on the pencil

- gets this list from a database query – what you see here is what your database contains

- proofread table – check spelling

- click on insert – can enter data straight into database – can test the table

Step 2 – Move Database into Dreamweaver

- leave the phpmyadmin window open, for reference

- enter dreamweaver

- works in last 3 versions of dreamweaver – does not work in dreamweaver mx

- create new site – not ftp and rds server

- first page of site definition dialogue

give site a name – don’t put any spaces in name

inClass2

- http address can fill in later

http://www.imagearts.ryerson.ca/jpascoe/inClass2/

- want to use server technology – php mysql

- edit locally, then upload to remote testing server (80% of the time)

- where to store files – at business: default will be your username and your documents folder -on your mac will be your site

- ryerson: don’t use default – can save to weston drive

- my computer – Data d drive- create folder name same as site name

- always confirm that its correct

- connect locally (usually) or connect by ftp (in this case) – if in grad lab connect to user name

- FTP

- ftp.imagearts.ryerson.ca (find out from whoever is managing your server what the ftp is)

- folder to store files: ppcm07/jpascoe

- login: username

- password

- test connection – don’t move until you have connected to web server successfully

- URL: always have to fix this -

change ftp to www.imagearts.ryerson.ca/jpascoe/inClass2 (folder name that you put your site in)

- same answer as first page

- error message – click ok and move on

- site definition: no, to check in and check out

- done

- top folder is root folder

- right click on folder – create new – images (copy images into this folder)

- manage sites – edit – advanced – default images folder – navigate images folder we just created and select it

- Make a page

- Click on root folder – Create new file instead of new folder

- Descriptive title for pages – insert.php – open

- give page a title – insert all

- send data between server and page – create a form

- needs entry fields and submit button – send into database

- insert – 3rd button – forms – first button – create new form

- form – text entry fields – make connection to database

- application – databases – + – mysql connection -

- connection name- anyname you want (rules apply)

- my sql server – localhost

- user name -ryerson user name

- password – last 7 digits of student number

- click select – connecting to databases that you have – your name, and information_schema (never use this one) – select database that has same name as username

- username should appear in last field

- when you work somewhere else – database name will be different

- drum – database

- click + sign by database connection – results in three items – only one you care about is tables – click + by tables – click + by name of table to see the fields table contains

- can see the name of each field when creating insert form in site

- insert bar – forms – new form

- cursor dashing inside red square – part of form

- Form elements – text field

- Text field – single line entry – ID for text entry should match field name

- ID: filename (get caps the same) – instructions to computer

- Label: what data entry person will read – please enter the filename

- dpme

- label shows up – text field is there

- click right arrow to put cursor where u want it

- repeat

- ID: category, label: please enter the category

(will know based on ID how to link it to the table)

- Caption: need text area instead of field (next button) – because its longer

- label: type in the caption

- need two buttons: submit and reset

- button – on the forms section

- reset: highlight submit button – properties panel (bottom of page) – Action – 2 choices, submit or reset (by default it is submit) – click reset – button changes to reset – don’t need label

-SAVE

- need to tell dreamweaver what to do when buttons are clicked

- no field for primary key – don’t want to send value, already auto-increment

- need to define server behavior

- application -server behaviour – click + – insert record – which form to send (not advised to have more than one form per page) -

Insert record

automatically form 1

connection: my connection

insert table: inclass2

columns:

- database gets values from dreamweaver form

- after inserting , go to: insert2.php (select webpage you want it to go to after it sends the data – have it go back to this page)

- little golden dot at bottom of form – insert stuff into database and return to this page

- upload and test – yes to dependent files

- test it in a browser – www.imagearts.ryerson.ca/jpascoe/inclass2/insert2.php

- worked if now mysql errors – get question mark at end of url

- type in filename of image correctly

- create page to view records

- under site – new file

in class assignment – do it next week (niso framework document – table 2 – list of metadata) – dublin core (only 15 fields)

content standard – online template

think about database assignment – what fields you need

www.ncecho.org/

- viewrecords.php

- title – Viewrecords

- need to show records from database

- bind data in webpage to data in database – tab name is bindings

- application – bindings

- bindings tab – click + – recordset (query)

- think of records set as a search – defining a search

- name only matters if you have alot of recordsets – connection is the one already set up – will fit in the table with first one it finds – select table you want to grab data from – columns all – filter (none – want all of them) – sort by filename – ascending (can do author, last name etc.)

- Test will do the query for you

- inclass ID – primary keys generated by sql

- bindings – recordset (drum=table) – click +

- lightning bolts – dynamic data (database data)

- use a table to organize

- Table: insert bar – common or layout – table – one column and as many rows as the fields you want to show – i.e 4 fields you put in 4 rows

- table width – 200 min. (table will expand to fit whatever is in it)

ok

- first item you want to be the image – common -images – image – select image source – select file name from data sources – recordset will appear – filename; format – none; url will need to change, put in before angle bracket type in: images/

ok

- type something into alternate text – alt attribute – if image doesn’t appear – this text will show up (not something specific since don’t knowwhat image)

- other three rows will be info from database – drag lightning bolt fields from recordset and drop into table

SAVE

Files tabs – highlight viewrecords.php – upload and put dependent files

test webpage in browser -

if filename is wrong – get error for picture

- this is why you keep myadmin open

- set repeated region – make dreamweaver automatically repeat

- go back to dreamweaver (always test)

- select table (click inside what you want to select – dreamweaver shows hierarchy along bottom of window – click button table)

- application – server behaviour – click + – repeat region; show – all records; makes it show all records on the same page

- repeat region = grey square – everything inside will get repeated

- SAVE and UPLOAD

- refresh view on browser

- shows everything in database

- if you have stuff on the back

- have 2 fields for filename

- add one more field – add one at end of table

- field: filename_verso

- digital scan is part of the data

2 weeks to do in class assignment (do this again with all 10 of the images)

- dublin core – embedded metadata in database

  1. Great tutorial on building web database! thanks for sharing!

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 48 other followers