Tag Archives: MySQL

SimpleBlog Work Post

4:30pm – This’ll be a short work session since I have to be somewhere in less than an hour, but I want to try and solve the AJAX error if I can before that. I’ve already taken a look at it and I’ve got no clue what’s going wrong. I don’t see any new code that would interfere with the jquery get function, yet it returns a fail result. So, I’ve gotta figure out under what conditions it could fail.

4:33pm – Oho! I found the problem. When I went to the php page itself it gave a syntax error. That explains it. That should be easy enoug to fix.

4:35pm – It doesn’t seem to have a syntax error in the file itself. I’ll try re-uploading it in case I don’t have the most recent version on the server.

4:46pm – Well I’ve gotten rid of the AJAX error but I still don’t have any posts showing. I wonder why that could be.

5:01pm – The AJAX error is gone, it was mostly a bunch of syntax errors in the PHP. But now it’s not putting up any posts and it’s not giving any errors. I added a data dump to console and found that it was getting a false result from the PHP script. That means the database connection isn’t working properly, in one of a few ways. It’ll take some effort to figure out what’s going wrong there, and I’m low on time, so I’m going to head out.

Tagged , , ,

More MyFirstChatroom Design

So, I’m continuing to work on the basic design of MyFirstChatroom. After discussing it with my brother, I’ve decided that the model_Chatroom class will model the entire database. So, it will have an array of 201 entries, and when that list fills up it will delete the last one and push the newest one in.


I’ll make the chatentry a TEXT type. That’ll give it a max size of 65,535, way more than enough for any chatting. I’ll have to make sure to limit the input to nothing beyond that, though.

Okay, the table has been placed on the database. If I need to change it, I can modify it later.

*work work work*

It occurs to me that a timestamp must be unique, since it’s accurate down to the clockspeed of the cpu and thus each call to the timestamp function is at a different time, so I can use it as the primary key of my db after all. That’ll save me the trouble of recycling 200 ids and simplify everything, so I’ll do that. *does that*

*work work*

For the most part I’m just copying the structure of most of my PHP programs. I’ve got a nice, commented block of code for accessing databases that I use. Not much to say about it. Making the model_Chatroom class work.

I’ve finished the Retrieve() function, which gets the list of chat entries from the database. Now I’m doing the Create() function, which creates a new entry, and deletes the oldest if there are already 200.

Alright I think that’s enough for now. The next thing I need to do is write the code that determines if there are over 200, and finds the oldest to delete it. I might have to figure out a different way of sorting the chat entries in order to rank them in age. Timestamp is probably different between MySQL and PHP.

Tagged , , , , , ,