Welcome! Log In Create A New Profile

Advanced

Assignment 2 - Databse Design

Posted by wsbraun 
Announcements Last Post
Announcement myUnisa availability 21 to 24 March 2019 03/17/2019 02:24PM
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
Assignment 2 - Databse Design
March 15, 2011 06:18PM
Hi Mac

In the tutorial 102 letter

The database structure table the course_student table is described as having 4 fields (sno, cid, year, fmark) yet the dump file does not have the fmark column listed.

Should we add this or is this a point of possible extension?

--

Student Number: 7298-786-3
avatar
Mac
Re: Assignment 2 - Databse Design
March 16, 2011 08:39AM
I removed it then forgot to put it back!. It is there for a purpose.... not used but to test your insert and update statements smiling smiley
The tut letter is updates, but you can use this:
Language: SQL
CREATE TABLE `course_student` ( `sno` int(6) NOT NULL DEFAULT '0', `cid` int(6) NOT NULL DEFAULT '0', `year` int(4) NOT NULL DEFAULT '0', `fmark` tinyint(3) NOT NULL DEFAULT '0' ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
Re: Assignment 2 - Databse Design
March 16, 2011 08:39PM
With regards to the fields that are required to fill in, there are some fields in the registration form that in a real world situation you would have as an optional field such as maiden surname and maybe even work telephone number, can we leave those fields as optional fields for registration and then validate the compulsary fields?
Re: Assignment 2 - Databse Design
March 16, 2011 08:45PM
Guys here's a simple function for checking empty fields


Language: PHP
function checkFields($fields){ if(is_array($fields)){ foreach($fields as $emptyField){ if(!isset($_POST[$emptyField]) || empty($_POST[$emptyField]) ){ $empty[] .= $emptyField; } } } return $empty; }   //Pass an array as an argument, the array should have names of the fields you want to check like below   $required_fields = array('field_1','field_2','etc');
avatar
Mac
Re: Assignment 2 - Databse Design
March 17, 2011 10:58AM
CHARLCROW-72771437 Wrote:
-------------------------------------------------------
> With regards to the fields that are required to
> fill in, there are some fields in the registration
> form that in a real world situation you would have
> as an optional field such as maiden surname and
> maybe even work telephone number, can we leave
> those fields as optional fields for registration
> and then validate the compulsary fields?

Just remember that you must work within the provided db structure, so you cannot add them
Re: Assignment 2 - Databse Design
March 17, 2011 02:31PM
Yes Mac I understand we cannot add fields but what about fields like Maiden surname that are in the provided db structure, I was asking if they can be optional fields for the user to fill in

For example if I were to fill in a form with that field(maiden surname) I would leave it blank because its not applicable to me, so there will be no value added to that field in that particular row of the db.
Just asking
avatar
Mac
Re: Assignment 2 - Databse Design
March 17, 2011 02:59PM
I read to quickly sorry..... saw "optional" and had it in my head that you wanted to add fields that does not necessarily add to the db....!

You can do what you want - but this would really be a "usability" issue that is not going to bring you more marks if you manage it differently - remember I am interested in your coding skills, not your webdesign skills...
Re: Assignment 2 - Databse Design
March 17, 2011 03:45PM
Ok thanks Mac
avatar Re: Assignment 2 - Databse Design
March 18, 2011 07:16AM
Morning Peeps smiling smiley

When you make the new user for your db, make sure you do it properly tongue sticking out smiley

My code wouldn't work because of it and it took me a good few hours to narrow it down to that. Whats weird was that I could connect to my db but my query wouldn't work. Just feel sooooooooo relieved I got it sorted.

Just thought I'd share

A word to the wise ain't necessary - it's the stupid ones that need the advice.
Student Number:72793775
Re: Assignment 2 - Databse Design
March 18, 2011 07:30AM
Hi Shaun

Could you please explain the solution to your problem, should we run into it as well.

My guess is that you did not assign the user rights to the database you created.

The user should probably have SELECT, INSERT and UPDATE to the new schema at the very least.

--

Student Number: 7298-786-3
avatar Re: Assignment 2 - Databse Design
March 18, 2011 07:49AM
I gave it those and DELETE.

When I created the user that works, under user name select "use text field" and type a user name. Password is simple and for host I selected local and it automatically named it localhost (did something else there last night and that's probably why it wouldn't work)

Solution:

When I create my connection to my db or when selecting the db I want, I always run a if statement that echo's something if it's unsuccessful and in this case it was successful so I moved on and looked at my query. Again I ran the if statement and it wasn't successful. I knew my code was 100% correct tho but just I couldn't figure out why. Honestly why I decided to try my default db info was just a last straw but lucky for me it worked. Then I went to the new user and changed the host and voila it worked with those details so meaning the other one didn't work because my "host" was incorrect in the user details.

A word to the wise ain't necessary - it's the stupid ones that need the advice.
Student Number:72793775
Re: Assignment 2 - Databse Design
March 18, 2011 12:53PM
Could some one explain to me the "includes/config.php" file. There are a few questions I have regarding it and Other questions that are not clear.

Should we have code that creates the database from scratch in the "config.php" file?
Mac, will have a database exaclty like the one we will be using or should we code SQL to create a new database if the one we using does not exist?

Should anyone have more information regarding database PLEASE Share!!! cool smiley
Re: Assignment 2 - Databse Design
March 18, 2011 01:11PM
Mac has given us the database to use so that he can equally evaluate all our assignments.

The "includes/config.php" file should include the connection details for the db eg:

Language: PHP
<?PHP   $user_name = "root"; $password = ""; $database = "addressbook"; $server = "127.0.0.1";   ?>

As such I can assume that you should not include the code to create the db in this file.

--

Student Number: 7298-786-3
Re: Assignment 2 - Databse Design
March 18, 2011 08:21PM
Besides the 4 main pages can we create other pages in the root directory, for example a page like delete_course.php which will have all the code to remove one row from the course db
Re: Assignment 2 - Databse Design
March 18, 2011 08:32PM
Good question Charl.... I also wondered this?
avatar Re: Assignment 2 - Databse Design
March 18, 2011 10:07PM
The tutorial says that there should only be 5 pages (4 + index). We should your else functions to perform all of these tasks in one page.
avatar Re: Assignment 2 - Databse Design
March 18, 2011 10:09PM
CHARLCROW-72771437 Wrote:
-------------------------------------------------------
> Besides the 4 main pages can we create other pages
> in the root directory, for example a page like
> delete_course.php which will have all the code to
> remove one row from the course db

Add it in your functions.php and then just call it in the manage course page smiling smiley

A word to the wise ain't necessary - it's the stupid ones that need the advice.
Student Number:72793775
Re: Assignment 2 - Databse Design
March 18, 2011 10:14PM
You know Shaun I didnt think about that, Thankssmileys with beer
avatar Re: Assignment 2 - Databse Design
March 20, 2011 09:18PM
Hey Everyone

Hey Shaun where you'll getting these exercise from? just recieved my cd few days ago and
want to get started. i dont have tut 102 yet.
thanks smile
avatar Re: Assignment 2 - Databse Design
March 20, 2011 09:57PM
Belanda Wrote:
-------------------------------------------------------
> Hey Everyone
>
> Hey Shaun where you'll getting these exercise
> from? just recieved my cd few days ago and
> want to get started. i dont have tut 102 yet.
> thanks smile

Do you still have the link to where you download the first tut letter from? It's there. Unfortunately I don't remember it and can't find the link sad smiley

A word to the wise ain't necessary - it's the stupid ones that need the advice.
Student Number:72793775
avatar Re: Assignment 2 - Databse Design
March 22, 2011 06:49PM
@shaun2010 look on the letter you received with your first cd there is a link on the letter that takes you to the 1st semester PHP website, you can then go to the downloads link to download the first tutorial letter, as well as the second one. smile

"I like nonsense, it wakes up the brain cells."
avatar Re: Assignment 2 - Databse Design
March 23, 2011 06:52PM
Hey everyone
Thanks guys downloaded tut102 it has 10pages.smile


<i>B.KALAPPA</i>
(72675691)
avatar Re: Assignment 2 - Databse Design
March 24, 2011 10:06AM
About Pages required:
You guys are right, the tut letter does call for 4 required main pages and rules on how to treat them, but doesn't say that you can't add more as you wish. So I don't see any limitation on the number of pages as long as the requirement rules aren't violated. Right?

Perhaps a third umpire is needed... Mac? :|

Student_Number : 73017612
avatar
Mac
Re: Assignment 2 - Databse Design
March 24, 2011 03:50PM
You can add more, as long as you do not change the db structure.
Re: Assignment 2 - Databse Design
March 24, 2011 04:35PM
Thanks Mac
hot smiley


I was really struggling with this one. However I think I will limit the number of pages I have on this project.
Re: Assignment 2 - Databse Design
March 27, 2011 11:48PM
I did'nt get tutorial 102, guys please help me, where can I find it so I can catch up?
Re: Assignment 2 - Databse Design
March 27, 2011 11:53PM
Guys please assist me about the tutorial letter 102, really need to catch up with you guys, a.s.a.p.....
avatar Re: Assignment 2 - Databse Design
March 28, 2011 07:54AM
@Absolom72945079

Can be found here

It'll have TUT101 and TUT102. Just click to save and download. Hope this helps

Check wsbraun's entry on the forum thread "CD#2" for more help if needed...

Cheerssmiling smiley

Student_Number : 73017612
Re: Assignment 2 - Databse Design
March 28, 2011 10:41PM
hi LabRat, thank you so much, God bless. Need to catch up with you guys on php.
Re: Assignment 2 - Databse Design
March 29, 2011 12:55AM
Some of you will probably think this is a stupid question, but I will ask it, Dr Mac is there a standard database name we must use for our database maybe I just missed that part in the tutorial letter. Secondly on xampp there is the demo sections can we use some of the code from these sections?
Sorry, only registered users may post in this forum.

Click here to login