Part I: Loading the PetCatalog database with data.
DATA:
Before you can do anything you need to put data into your database. Fields and data you will need to supply for the Pet table include:
petName, petType, petDescription, price, pix (pix is a path/filename of an image of every animal in your pet catalog) You may make up your own entries, or you may use mine.
Your database must include AT LEAST 12 records. You should have at least 4 different petType's listed, and each pet type must have at least three records.
Here is a display of my Pet table contents:
Table: Pet
Note: the petID was defined as auto_increment, so it is generated automatically every time you insert a new record.
petID | petName | petType | petDescription | price | pix |
|
1 | Buddy | horse | brown horse | 999.99 | Buddy.jpg | |
2 | Tigger | cat | young tiger | 1769.99 | Tigger.jpg | |
26 | Carrie | bird | baby Crane with mother | 57.19 | babycrane.jpg | |
17 | Eagle | bird | Bald Eagle chick | 198.69 | BaldEagleChick.jpg | |
18 | Baby Solanobeach | horse | Young horse | 198.69 | solanobeach.jpg | |
19 | Flicka | horse | Young horse running | 267.19 | equine5b.jpg | |
8 | Sunshine | cat | kitten mixed | 3.99 | Sunshine.jpg | |
9 | Ruff Duff | dog | beagle puppies | 8.99 | RuffnDuff.jpg | |
20 | Fuzz Ball | cat | small fuzzy kitten | 7.19 | fuzzBall.jpg | |
21 | Snowey | cat | baby snow leopard | 197.19 | babysnowleopard.jpg | |
16 | prettyBoy | bird | parrot from Bush Gardens | 199.99 | prettyBoy.jpg | |
15 | Raison | cat | kitten mixed | 3.99 | raison.jpg | |
25 | Mutt and Jeff | cat | kitten buddies | 27.19 | kitten_friends.jpg | |
24 | Floppy | dog | hound dog with kitten friend buddies | 27.19 | 106192.jpg | |
27 | Peanut | dog | small cute puppy | 89.98 | Louis.JPG | |
Your table PetType needs fields: petType and typeDescription, my PetType table follows. (You can of course create your own pet types.)
Table: PetType
|
petType Name of pet category (primary key) |
typeDescription description of category |
|
|
cat |
The cat is a predatory carnivorous species of crep... |
|
|
horse |
The horse (Equus caballus) is a hoofed (ungulate) ... |
|
|
bird |
Birds (class Aves) are bipedal, endothermic (warm-... |
|
|
dog |
The dog is a domesticated subspecies of the gray w... |
|
Finally the PetColor table needs fields: petName (same names as in Pet table), and pix (same image file used in Pet table). Here is my PetColor table, but of course you can make up your own data, if you wish.
Table: PetColor
|
petName Name of pet primary key 1 |
petColor color name primary key 2 |
pix path name to graphic file containing picture of pet |
||
|
Buddy |
brown |
Buddy.jpg |
||
|
Tigger |
gold |
Tigger.jpg |
||
|
Carrie |
golden brown |
babycrane.jpg |
||
|
Flicka |
brown and white |
equine5b.jpg |
||
|
Eagle |
gray |
BaldEagleChick.jpg |
||
|
Baby Solanobeach |
brown |
solanobeach.jpg |
||
|
Sunshine |
gold and white |
Sunshine.jpg |
||
|
Ruff n' Duff |
white, black, brown |
RuffnDuff.jpg |
||
|
Fuzz Ball |
gold, white |
fuzzBall.jpg |
||
|
Snowey |
brown, white, tan |
babysnowleopard.jpg |
||
|
prettyBoy |
red, yellow, blue |
prettyBoy.jpg |
||
|
Raison |
black, brown, tan |
raison.jpg |
||
|
Mutt and Jeff |
black, white and gold, wh |
kitten_friends.jpg |
||
|
Floppy |
golden brown |
106192.jpg |
||
Pet Catalog Images
You will need an image of every animal you have in your pet catalog. There are a number of sites on the web that archive images you can use. Or if you wish, I've zipped together all of the images I have, which you can download and use if you wish.
| (click on the thumbnail images to load the full-sized picture) |
[top] |
Inserting Data into Tables
You can insert
data into your tables using mySQL statements (refer to the text PHP & MySQL for
Dummies chapter 4) or you can use phpMyAdmin for inserting data, as illustrated
with screen captures below. To insert records into your Pet table, go to
your profhicks control panel, and open phpMyAdmin. Select your
Pet Catalog database, then select
the Pet table. To insert a new
record, click the Insert tab at the top of the screen.
From this screen you can add the new data record information. You do not have to add any
value for the petID, since it should be automatically generated if you set up
your database as specified. Click the Go button when you have finished.
You will then be
presented with the SQL query statements generated. To verify your new
record, click on the Browser tab on the top.
[top]
Then repeat the
same process for the petColor table, illustrated below on the right.
Insert data into the petType table in the same way. You may use the four types I have in my table or different types for your own. For type description, field which is 255 characters, copy descriptions from a book or the internet.
|
petType Name of pet category (primary key) |
typeDescription description of category |
|
|
cat |
The cat is a predatory carnivorous species of crep... |
|
|
horse |
The horse (Equus caballus) is a hoofed (ungulate) ... |
|
|
bird |
Birds (class Aves) are bipedal, endothermic (warm-... |
|
|
dog |
The dog is a domesticated subspecies of the gray w... |
|
[top]
Changing or Modifying Data Records.
If you want to remove a record or
change the data assigned, you can also use phpMyAdmin. First select the table
you want to change, then select the Browse tab at the top
Then click on the pencil in the row you wish to edit. (see full sized image)
This window opens, where you can
change the Value of the fields as you wish.
To delete a record, just click on the red X in the row you wish to delete.
[top] [363 Home Page]
This page was last updated on 12/07/2008 by Linda M. Hicks