Welcome! Log In Create A New Profile

Advanced

availability table

Posted by 46620710 - Pappy 
Announcements Last Post
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
availability table
April 23, 2013 12:51AM
Good day fellow students and Mac,

I seem to have problem which is a bit confusing to explain so bare with me guys.

Currently I am on my OOP5_select.php page. On this page we are required to set up our database with 3 tables. I do understand both the model and colour tables.

I’m not sure if I am doing my availability table right or not. It is looking something like this. If I’m wrong please correct me guys.

avail_id model_id colour_id
1 1 1
2 1 2
3 1 3
4 2 1
5 2 5
6 2 4
7 3 2
8 3 6
9 3 1


The other problem I am experiencing now is that on pg8 of the portfolio tut letter. It advises that on below 'connection closed' we need to display our database but if integers are used as the data type. How come sample given on pg8, under "availability" it displays yes and no.

Assistance is required guys ASAP.

Thanks
Re: availability table
April 23, 2013 08:46AM
Hi Pappy,

Your availability table is OK (altough it doesn't need a avail_id, jus model_id & colour_id, but it doesn't hurt to have avail_id)

In regard to the combined table you have to add below the "connection closed" the sample show in "availability" as yes or no, if you recall from Macs code he has a function that checks if the model is available in a specific colour then if yes echo "is available" if not echo "is NOT available". I think Mac wants more or less a same type of function but he wants us to write it our own way to see if we understand the code and echo out if available "Yes" instead of "is availible" and if not echo "No" instead of "is not availible.

Remember he says we do not need to use the above class, use your own code with mysql queries.

There is also one other tip I can give you that seems you didn't catch yet, Mac is instructing us to do all this below the "connection closed" part meaning you will have to reopen the connection or do your queries before the connection closed but display after...

I don't understand the part where you are mentioning that integers are being used as the data types...
avatar
Mac
Re: availability table
April 23, 2013 09:00AM
Yes and no question. You are not just printing the table out as it is - you need to write code that interprets what is in the table and print it out in human readable format.

For example, what model does 1 represent? What colour does 1 present? There is a row, then it is yes.
Re: availability table
April 23, 2013 11:37AM
Thanks guys,

I think I got an idea on how to go about doing it.

Always glad to know that there is someone always willing to assist.

Much appreciated.
Re: availability table
April 23, 2013 12:49PM
I am now lost here.

On availability table, the fields are avail_id, model_id and colour_id, and when I echo out the table I get something like:

Model Colour Availability
******* ******* ************
x35 Black 1
i20 White 2

On the code given to us, are we not supposed to echo out the results as:

"The model i20 is available in the colour White" instead of "The model i20 is YES in the colour White" and "The model x35 is NO in the colour Black"

Please clarify.
avatar
Mac
Re: availability table
April 23, 2013 04:40PM
Now what will it help if you tell someone "The model i20 is YES in the colour White". It is meaningless.
Re: availability table
May 20, 2013 03:55PM
hi 46620710 - Pappy

I suggest use netted looping and have a method that return yes or no if available or not
Sorry, only registered users may post in this forum.

Click here to login