Since I spent all of Wed. and Thurs. evenings working on my little Ajax problem, I decided I was going to take the night off and go out for a bit. Naturally, this is when it decided to rain. It didn't just rain, though-- it rained sideways because of the heavy winds.
So, I wound up staying home and eventually got back to the ajax project. The back end piece is all done. I've got the mySQL database set up, with a lame little database table of red wines and associated info in it. I've got php talking to it, so my little web app can query the database and show results. It even sends the results back in XML.
Now that the back end is complete, it was time to focus on the client side of things. I'd been reading good things about some of the extra features of AJAX frameworks (e.g. Prototype and Dojo), so rather than go with the bare bones implementation of AJAX code I got from the class, I decided to download and use the Prototype framework instead. Nothing against Dojo, it's just that more third party tools seemed to use Prototype than Dojo, such as OpenRico.
"Installing" Prototype on my web page (more like including it, actually) was pretty straightforward and easy. I had to modify my thinking a bit from what I learned and did in the actual class (e.g. creating the object "up front" and then passing info along at a later point), but I wound up being able to send my request via Javascript in the background, getting an XML response, and then displaying it in a Javascript alert on the client. I still need to write some Javascript (wines.js) to handle the unique code for this application, but I'm almost done with it. Of course, I've saved the most difficult (for me, that is) part for last-- using Javascript to manipulate the web browser's Document Object Model, aka DOM, for short.
I've always hated working with the DOM. I think a lot of my frustration has been that different browsers had different models, and you had to check each one you looked at to figure out how to work it properly. The good news is that the models have moved closer to being standard, and with the getElementById function in Javascript I no longer have to worry as much about where in the tree a particular element lies.
A liberal arts grad on the Information Superhighway, stuck in a traffic jam at the intersections of Technology, Psychology and Security.
Showing posts with label php. Show all posts
Showing posts with label php. Show all posts
Saturday, October 20, 2007
Wednesday, October 17, 2007
mySQL, php, and agony
I recently completed an AJAX course. Naturally, I wanted to come home and try out the things I had learned, to reinforce them.
Oh. My. God.
I already had mySQL (a database system) installed on my iBook from months ago, and php (a web programming language that specializes in connecting databases and web pages) was also installed a long time ago . . . but I'd never tried to actually connect them before.
When I was 8, I rode a tobaggon down a steep hill and slammed sideways into a tree. It was one of the more painful experiences of my life.
Wrestling with my php code and getting it to successfully communicating with the mySQL database was slightly less painful than that, but it lasted much longer.
I googled every error message I received. I tried ext/mysql and ext/mysqli. I recreated my database user. After spending nearly the entire evening trying and failing, I discovered that apparently if the root user in mySQL has a password, it will not allow the connection to work. It made no sense, but I cleared the password, and sure enough, it worked.
Too bad it's bed time and too late for me to do any of the actual Ajax material I learned. :(
Oh. My. God.
I already had mySQL (a database system) installed on my iBook from months ago, and php (a web programming language that specializes in connecting databases and web pages) was also installed a long time ago . . . but I'd never tried to actually connect them before.
When I was 8, I rode a tobaggon down a steep hill and slammed sideways into a tree. It was one of the more painful experiences of my life.
Wrestling with my php code and getting it to successfully communicating with the mySQL database was slightly less painful than that, but it lasted much longer.
I googled every error message I received. I tried ext/mysql and ext/mysqli. I recreated my database user. After spending nearly the entire evening trying and failing, I discovered that apparently if the root user in mySQL has a password, it will not allow the connection to work. It made no sense, but I cleared the password, and sure enough, it worked.
Too bad it's bed time and too late for me to do any of the actual Ajax material I learned. :(
Subscribe to:
Posts (Atom)