عدد المساهمات : 2429 نقاط : 302124 السٌّمعَة : 4 تاريخ التسجيل : 20/09/2008 العمر : 54 الموقع : www.aoua.123.st
موضوع: M275 Web Development Using PHP and MySQL الخميس نوفمبر 16, 2017 2:15 am
Faculty of Computer Studies M275 Web Development Using PHP and MySQL Tutor Marked Assignment – Fall Semester 2017/2018
Cut-Off Date: TBA Total Marks: 100 Contents This TMA consists of 3 questions, where you are required to answer all of the questions. The TMA will be corrected by your tutor and you will be provided with a proper feedback file to understand your mistakes and avoid them on the final exam.
Plagiarism Warning: As per AOU rules and regulations, all students are required to submit their own TMA work and avoid plagiarism. The AOU has implemented sophisticated techniques for plagiarism detection. You must provide all references in case you use and quote another person's work in your TMA. You will be penalized for any act of plagiarism as per the AOU's rules and regulations.
Declaration of No Plagiarism by Student (to be signed and submitted by student with TMA work): I hereby declare that this submitted TMA work is a result of my own efforts and I have not plagiarized any other person's work. I have provided all references of information that I have used and quoted in my TMA work.
Name of Student: Signature: Date:
M275 – TMA Page 2 of 4 2017-2018 / Fall Question 1 [20 Marks] Using the AOU e-Library or other online sources, search for and briefly discuss at least 3 advantages and 1 disadvantage of using PHP’s mysqli library over using PHP’s mysql library. Make sure to state the reference (where the info was gathered) in order to receive a full mark.
Question 2 [50 Marks] This question is based on the “guessing machine” (Chapter 11) that was discussed during the tutorials. You are asked to implement the PHP and HTML code that will complete the program below. The program is mainly a guessing game to try and guess a random, odd number between 1 and 99. Each time the user guesses the number, a new number is provided.
Here is a sample run with explanations that are followed by some hints:
For the first visit, the user will be presented with a welcome message and some info on what to guess. The user enters 20. The user is presented with a message that 20 is odd. He changed it to 25.
M275 – TMA Page 3 of 4 2017-2018 / Fall The user is presented with a message that 25 is small and he tries 35. The user is presented with a message that 35 is big and he tries 31 The user’s guess is correct and the game continues with a new random odd number.
Hints:
rand (1, 99) provides a number between 1 and 99 including both odd and even numbers.
$x = $x | 1 The “|” is used to perform bitwise or between $x and 1 which is used to convert $x to an odd number in case it was even.
You might need to keep track of the random number the user is trying to guess using the following line of code: Note: The sample run in the table above demonstrated the 5 different messages that are to be presented to the user. M275 – TMA Page 4 of 4 2017-2018 / Fall Question 3 [30 Marks] Writing SQL queries: Read the section “Using Join” of Chapter 16 in the book (pages 312 -> 314 in the fifth edition) then answer the questions below: Consider the following tables: students student_id firstname lastname 123 Some One 125 Another One 167 Good Student grades student_id gpa 123 2.34 125 3.21 167 3.86
a- Write an SQL queries that would create the tables students and grades based on the tables above. b- Write SQL insert queries to add the data into the tables as it is presented in the tables above. c- Write an SQL select query to find the honors students (whose GPA is above 3.5) Note: You might need to search online for the MySQL built-in function “LEFT” and use it with the function “CONCAT” to generate the name of the student as the following table: name gpa G. Student 3.86