So the for loops and all that was hurting my head and I tried two different queries in the one php file and when I had it for my name it printed nothing as I didnt have the Max(time) the other user did. This was a problem but Colin was the bestest and helped me so I used ASC LIMIT which prints out the two most recent times and it works woop woop. I'm going to add another user to see if it still works for more users.
The code needs to be cleaned up but that can wait.
Thursday, January 17, 2008
Wednesday, January 16, 2008
I'm stuck
So the printing out a line for each person is hard and I'm officially stuck, I used the MAX(time) method and that works for only the most recent obviously, so it only prints out "Christine was last seen at home at [maxtime]".
I tried a few other methods I think the LIMIT method could be a possibility but I wasn't able to incorporate it into my code.
I was thinking maybe there could be a way to have a query for each person to print out their max times but once again I'm not sure how to go about this, any ideas?
I tried a few other methods I think the LIMIT method could be a possibility but I wasn't able to incorporate it into my code.
I was thinking maybe there could be a way to have a query for each person to print out their max times but once again I'm not sure how to go about this, any ideas?
Tuesday, January 15, 2008
I got my table printing out stuff in order of the most recent input, that was ruining my life for a while but I've gotten to grips with how time works in sql, I had to change it back to TIMESTAMP but it doesn't seem to be a problem.
I've been trying to get it to print out the most recent input rather than all of the fields and it now prints out the most recent one, I'll have to do a bit more to get it to print out a line for each person but hopefully that won't be as time consuming as the other one which turned out to be one line of SQL code
I've been trying to get it to print out the most recent input rather than all of the fields and it now prints out the most recent one, I'll have to do a bit more to get it to print out a line for each person but hopefully that won't be as time consuming as the other one which turned out to be one line of SQL code
Saturday, January 12, 2008
Database Fun
Yesterday I added some test data to my two tables and I have a php page displaying fields from both tables in a table, e.g., Name, Location, Time using the SELECT keyword, i preferred this over the JOIN keyword. I have to change it from text into sentences like Christine was at home at 1.20p.m.
At the moment it just prints out everything that is the same in both tables so I have to get it to print out the recent location added by someone. I had my 'time' field as type TIMESTAMP but apparently this doesn't work well with comparisons so I'll have to change that probably to DATETIME. TIMESTAMP was handy because it printed out the date and time by default, hopefully DATETIME does this too.
I'll probably need to alter my database a little once most things are working, like the IP address is of type TEXT so it takes in anything at the moment but that's not hugely important right now, also the collation default in phpmyadmin is swedish for some random reason but it works in english so i'll leave it!
At the moment it just prints out everything that is the same in both tables so I have to get it to print out the recent location added by someone. I had my 'time' field as type TIMESTAMP but apparently this doesn't work well with comparisons so I'll have to change that probably to DATETIME. TIMESTAMP was handy because it printed out the date and time by default, hopefully DATETIME does this too.
I'll probably need to alter my database a little once most things are working, like the IP address is of type TEXT so it takes in anything at the moment but that's not hugely important right now, also the collation default in phpmyadmin is swedish for some random reason but it works in english so i'll leave it!
Friday, January 11, 2008
First meeting of 2008
I met with Graeme and Steve yesterday to discuss my progress and what I need to do next with regards to my database.
I need to input some test data and work from that to get stuff working, i'll need to have two tables in my database using each other to get all the information required, one table will have ID, IP address and location e.g., HOME, SCHOOL etc, the other table will have ID, IP address and the time it was last updated.
I'll then need to have the two tables working together and printing out a line for each person, e.g., Christine was at home at 1.20 p.m.
Once I have that working I can try to find a way to obtain the IP address rather than typing it in manually.
I need to input some test data and work from that to get stuff working, i'll need to have two tables in my database using each other to get all the information required, one table will have ID, IP address and location e.g., HOME, SCHOOL etc, the other table will have ID, IP address and the time it was last updated.
I'll then need to have the two tables working together and printing out a line for each person, e.g., Christine was at home at 1.20 p.m.
Once I have that working I can try to find a way to obtain the IP address rather than typing it in manually.
Wednesday, January 9, 2008
Database Interactions
I have my website getting the information inputted by a user and storing it in my database using PHP and today I did the opposite, I can now also display the contents of my database on a web page so I'm a happy camper.
I have to think more about my database now and decide what needs to be stored in it.
I have a meeting tomorrow so there'll be a huge long blog to write after that more than likely.
I have to think more about my database now and decide what needs to be stored in it.
I have a meeting tomorrow so there'll be a huge long blog to write after that more than likely.
Friday, January 4, 2008
Christmas is over, sob
So I started work yesterday and I got my Chapter 2 draft finished and have included my abstract and stuff in the final report template.
Today's goal was to fix up my simple php file as the input from my html form wasn't outputting to another php file but I have that fixed and working now although it is very basic but as long as it's working that's enough for me at the moment.
The next task is to try and get my php file to interact with my database. Not quite sure to go about this but google will be my friend and I'll read up on it.
Today's goal was to fix up my simple php file as the input from my html form wasn't outputting to another php file but I have that fixed and working now although it is very basic but as long as it's working that's enough for me at the moment.
The next task is to try and get my php file to interact with my database. Not quite sure to go about this but google will be my friend and I'll read up on it.
Subscribe to:
Posts (Atom)