Within this blog post I will explain the errors and problem solving I have undertaken so far, although i have explained various areas of code when it came to testing and echoing the information I encountered numerous errors. Within these errors some where easier than others to solve unfortunately those complex ones needed assistance therefore I arrange a meeting with Gaynor for this afternoon.
Jointables.php
The purpose of the jointables.php was for it to display users information once they have logged onto the system. My previous code I had developed for this page consisted of a long winded query that did not specify fully what was needed to retrieve.
Old code
As you can see from the code displayed below I attempted to echo out all the information from only one query. My aim was to gather the user, their folders and files within the system. This was not the best method to use as the query was too long winded and not specific enough for what I wanted. Also there were errors within the code
The image below shows one of the various errors encountered went attempting to echo out the information within the query.Within this error a parameter was missing within the query, it was sorted within the next stage where the code was split and separated.
Updated Code
With the help and advice from Gaynor I was able to adapt and separate the long winded query to be more appropriate and functional. I first divided the code into three queries,
Change of Names
During my one to one with Gaynor she realized that some of the names I had assigned within my database were possibly reserved. I also realized that some of the database table names and sub names were repeated. This is a simple database attribute that I had forgotten and another reason why the functionality of the code would have not worked properly therefore I went ahead and adjusted the names in order to avoid any conflicts. The user table name does not seem to be reserved although the name for the table file did need some alteration in order to avoid conflicts. I decided to only make a minor change to the name in order to avoid confusion when writing the code therefore I made it plural to files.
Within the files table the userid coloumn name already existed within the user table therefore I made another alteration to usid. I can still identify that it is an id and the us can represent the user keeping the names similar allows me identify the attribute easily avoiding any confusion when coding the rest of the project.
The subfolder table undertook a name change process, the timestamp name colounm is also a reserved name therefore I changed it to timest in order for it to relate to what it is. The userid is also present within this table therefore for it to be different to the file and user table I changed it to uid.
During the process of adjusting the database tables I started adding some user information in order to be able to test the login and upload page. I also added some subfolder and filenames so that I can test if the information is stored within the database.
Brainbell.com. n.d. Php - Php Mysql - Joins With More Than Two Tables Tutorials. [online] Available at: http://www.brainbell.com/tutors/php/php_mysql/Joins_with_More_than_Two_Tables.html [Accessed: 17 Feb 2014].







No comments:
Post a Comment