More Database News

I have gotten past several hurdles to have at least a skeleton of a functioning database. You can add quotes related to resource and also add notes related to either quotes or resources. I’m also working on the page design and thinking about other things I want to add like a “show quotes” link in the Resource list that shows up when you do a search. And I also need a “show notes” button in the Quotes list that shows up when you search.

There are several pages still to be done: a quotes edit and delete and a notes edit and delete.

Then I need to start working on querying: what results do I want? And what do I want to be able to do with them when I get them (edit, delete, etc.)

I also need to work on the pages for different types of resources. I’ve got all the fields created in my database. I need to add them into the resource data entry pages. So…lots to do but I think I know it’s doable.

Monday Morning Update

Hard to believe it’s been two weeks since I posted anything at all but it’s not for lack of work. I decided I needed some academic work so have been reading about php. I have tinkered with the database, adding fields based on RefWorks. I have also added a page for adding quotes and, hopefully this afternoon, will put one together for adding notes. But I took some time to work with queries and now have two nested queries that use a function to show all the resources related to an author and all the authors related to a resource. Here’s the resource with author query that returns all the authors associated with a book. And here’s the author with resource query that returns authors with all the resource associated with them. I used a query from the Williams and Lane book as a basis for these.

Monday Morning Update

With just a little code review help from my husband, I was able to go to bed last name knowing that my database is working! I was able to use PHP to write to my lookup table and then do simple searches on authors, keywords, and types. I have a long list of things to do:

1. Pull-down menu to choose the type of resource (books, journals, etc.) that brings up a specific data entry page. I built one in html but it didn’t carry the type_id variable to the data entry page so the user had to choose the type twice.
2. Complete the delete resource and edit resource pages in the current version of the database.
3. Diagram the database using fields from RefWorks.
4. Put the database connection script into an include that I can just drop into each page. (This idea came from my husband: I have just been copying and pasting the connection script into new pages but he said using the include would be more secure.)

Then there’s a TON of coding to do!! But at least I feel like I have a proof of concept right now. I am also not ready to wean myself from the book yet. I could probably do a simple php script from scratch but I still need an example. Bu now I have my own. My biggest problems are getting the field and variable names wrong. The process can be frustrating but there is usually some simple change to make the code work. And it’s pretty exciting when it does work!

For now, I have a couple other projects that I have to work on but I’m hoping to find a little time to code sometime today. If I can work in an hour or so a day, I think I’ll remember the process better and be able to chip away at the work.

Getting Closer

So, I have been coding every spare minute although the weather is beautiful so I took some time off yesterday afternoon and this afternoon. But I’m back at it because I feel like I am so close but I need to step back a minute and consider my issues:

I decided to call the project “noter” and have created a main index page here. A user can add an author, a keyword or a resource (for right now books only). And the resource entry form has a pull-down menu for type and checkboxes for authors and keywords. Because I want to design separate entry forms for each type of resource, I started with a page for books. (I spent some time with RefWorks and have a general idea of what fields go with each type. I’ve already got the types from RefWorks in the database and will eventually add the other fields as well.) The type ID works (although it took me awhile to get it to recognize that I had chosen a type).

Here are my two major problems right now:

1. The code that links the resource id with the keyword id is writing correctly to the keywordlkup_r table so that resources are associated with keywords in a many to many relationship. However, when I use the resource search page and search on the keyword, I see ALL the titles in the database.

2. The code that links the resource id with the author id in the authorlkup table is not writing correctly to the table so resources are not being linked with authors. Thus, when I use the resource search page and search on author, I see nothing.

3. The text search doesn’t work either.

I’m a little stumped right now. Somehow, the search isn’t looking the right place it would seem in problem #1. for problem #2 I think it’s an issue of having two chunks of code back to back. The join for the keyword/resource is first so it gets executed but the second one doesn’t. The page does indicate that the resource was added to 0 authors so it recognizes that it isn’t working. Hmmm…And, I suspect when I solve #1, I will also solve #3 and that would be the break through because it would mean that the relations were working.

Some Very Simple Code

I managed to devote more time this afternoon and have not only a database to show for it but two php pages that display information. The first one queries just the resource table for titles. The second one queries both the resource and the author tables to display titles with their authors. It has a problem in that it repeats the listing over and over for the 30 lines allotted.

Despite that, I feel pretty good about my database. Now I really have two things to do: draw a picture of the database and continue learning how to query using php. For the second page referenced above, I let phpMyAdmin write the php code.

At Least Some Success

A fruitful two hour work session! I created tables and learned to do elementary joins. I understand how to make joins between two tables that have a one to one relationship. Now I need to figure out how to query in order to get all the quotes and notes associated with a resource. (And I noticed that phpMyAdmin will even write the php code for you!) I followed Ullman’s directions although I created tables related to my project. Now, I’ve turned to Williams and Lane and later this afternoon (after teaching a class), I plan to settle in and read more about relationship databases. I know, I know: I should have done all that before starting to create tables but I just needed to at least start something even if it has to be changed later. Besides, I have a pretty good diagram of the wikindx database as well as my own work in Access. So, I just created a barebones bibliography skeleton and added notes and quotes tables. I did use RefWorks’ list of types of resources.

The Wonders of PHP

Just spent a very productive hour working on my new blog. While I am not directly programming, I am manipulating someone else’s code to customize my page. I’m actually surprised at the small amount of code here for something that is really pretty powerful.

I’ve always wanted to run my own blog. I like this interface and the ability to create categories. So I am going to combine my two personal blogs here and use the comments feature to sort them. I just feel the need to simplify. I will keep the Virginia Community of Learning blog up and running although I don’t know if anyone ever visits it or not!