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.
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.
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.
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.
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.
Well, I wasted a lot of time last night trying to get logged into mysql on my simplykaren server. Then, I tried creating a database and got a variety of different error messages ranging from incorrect syntax to access denied. So…I’m giving up on the terminal window and working with phpmyadmin to create my databases for now. I am eager to really dig into this project and want to get past the “stalled out” feeling I have had for the past week.
It is now 2:30 and I really have spent close to four hours working with MySQL. I used phpMyAdmin for the first part of the session and followed the directions to create the special relation table that allows you to make relational links. I also added a few records to see how the linking works and immediately discovered that I was unable to do one-to-many relationships.
I spent the past hour or so working with MySQL in the MySQL monitor window, typing commands and I think that may be how I continue for now. While it’s tempting to have a GUI interface, I think I need to really learn from scratch. So, tomorrow (or maybe late tonight while I watch the tape of the debate), I am going to start working on Chapter 4 in Ullman’s book using the monitor window.
Of course, I have nothing to show for this since I’m doing it all locally!
I had high hopes for this blog…I was going to read through all the ed news stuff I get everyday and leisurely post ideas and issues while also ruminating on programming. All very Zen. Then, this week hit! It has been crazy and it’s not over yet.
Monday was a workshop on the Northern Neck on Integrade Pro, helping teachers work with the gradebooks we set up in August. Most of them seem to be doing fine as they figure out how to adapt the technology to their grading styles. It occured to me that “grades” given by school teachers really don’t mean all that much since each teacher has a different way of calculating grades. Some include behaviors like punctuality and neatness. Others focus mostly on testing while yet others give lots of extra credit. For my own part, I generally had a range of grades in my reading classes but almost everyone got an A in my computer class. Different subject matters, I suppose. Different treatments. But extensive comments about grading come another day.
Tuesday started REALLY early for me but I had a great time with a group of elementary science methods students playing with digital microscopes and Kidspiration. One of the students went to her placement school later that day, asked the media specialist about the programs and learned that the school owned a site license. So the pre-service teacher helped the in-service teacher install the programs! WOW! Direct impact on what happens in the classroom. I called my consultee for 602 and then had class until 7 and then OOTW rehearsal. When I got home, I still had stuff to do to prep for my Wednesday classes.
And then there was yesterday: dentist, quartet rehearsal, ED 304, and T02! Got home around 9:30 and vegged out to the last half hour of The Apprentice.
Which brings me to this morning. I planned to use the time to read Dr. Leslie’s article (very good and much more later) and then start working on my database. Unfortunately, I discovered that the feature that allows relations is turned off on both my local machine and my server. There are configuration directions that I understand about half. For instance, I get that there is a script that can fix this problem but I’m not sure how to “import” the script as the directions say. Anyway, I need to get back to it because with a little reading, I CAN figure this out but so far in the interest of avoidance, I have payed a bill, cleaned the living room floor, and wrote this blog entry.
But now it’s time: I’ve got a fresh cup of coffee, I ate a little breakfast and I have four or five hours to work on this problem. I’d like to get it solved before Bob returns at lunch time. Wish me luck!
An article from The Japan Times lamenting the ignorance of Japanese students when it comes to astronomy. So it’s not just American kids after all! The Japan Times Online
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!