Skip to content

CS310 - Open Source Web Application Development (PHP, PERL, CGI, Mysql)

7 Topics 25 Posts
  • CS310 GDB 1 Solution and Discussion

    1
    0 Votes
    1 Posts
    230 Views
    No one has replied
  • 0 Votes
    4 Posts
    667 Views
    cyberianC

    @Zara-Rana-Ilyas
    No its sample code not Solution

  • 0 Votes
    3 Posts
    191 Views
    zareenZ

    Solution Idea!
    php file
    CS301.php

    <?php $host = "localhost"; $user = "root"; $password = ""; $dbname = "bc12345"; // Create connection $conn = mysqli_connect($host, $user, $password, $dbname); // Check connection if (!$conn) { die("Connection failed: " . mysqli_connect_error()); } $sql = "INSERT INTO `sales` (`ID`, `Name`, `Region`, `Client_Name`, `Unit`, `Unit_Cost`, `Date`) VALUES ('5', 'boll point', 'south', 'Jhon', '230', '120.99', '2020-01-12')"; if (mysqli_query($conn, $sql)) { echo "New record created successfully"; } else { echo "Error: " . $sql . "<br>" . mysqli_error($conn); } mysqli_close($conn); ?> <!DOCTYPE html> <html> <head> <title>CS310 Assignment</title> </head> <body> </body> </html>
  • CS310 Assignment 2 Solution and Discussion

    Solved
    3
    0 Votes
    3 Posts
    522 Views
    zareenZ

    Idea Solution

    <?php if(!isset($_GET['customer_id']) || !isset($_GET['units'])){ $customer_id = 0; $units = 0; } else{ $customer_id = $_GET['customer_id']; $units = $_GET['units']; } $amount = 0; if($units > 0 && $units <= 50) { $amount = $units * 0.50; } else if($units <= 150) { $amount = 50 * 0.5 + (($units - 50) * 0.75); } else if($units <= 250) { $amount = 50 * 0.5 + 100 * 0.75 + (($units - 150) * 1.00); } else { $amount = 50 * 0.5 + 100 * 0.75 + 100 * 1.0 + (($units - 250) * 1.50); } $tax = $amount * 0.18; $payable = $amount + $tax; $lp_surcharge = $payable * 0.05; $late_payable = $payable + $lp_surcharge; ?> <html> <head> <title>Assignment No. 2 (Solution) - Fall 2019</title> </head> <body bgcolor="#CCCCCC"> <table width="1800" border="0" align="center" cellpadding="20" cellspacing="0"> <tr> <td height="200" colspan="2" align="center" valign="middle" bgcolor="#CC6633"><h1>Natural Gas Company Pakistan</h1></td> </tr> <tr> <td width="300" align="center" valign="top" bgcolor="#FF9966"><table width="100%" border="0" cellspacing="0" cellpadding="20"> <tr> <td align="right"><strong>Customer ID</strong></td> </tr> <tr> <td align="right"><strong>Units Consumed</strong></td> </tr> <tr> <td align="right"><strong>Cost of Gas</strong></td> </tr> <tr> <td align="right"><p><strong>Taxes (18%)</strong></p></td> </tr> <tr> <td align="right"><strong>Payable within Due Date</strong></td> </tr> <tr> <td align="right"><strong>Late Payment Surcharge (5%)</strong></td> </tr> <tr> <td align="right"><strong>Payable after Due Date</strong></td> </tr> </table> </td> <td height="500" align="left" valign="top" bgcolor="#FFDECE"><table width="100%" border="0" cellspacing="0" cellpadding="20"> <tr> <td><strong><?php echo $customer_id; ?></strong> </td> </tr> <tr> <td><?php echo $units; ?></td> </tr> <tr> <td><?php echo $amount; ?></td> </tr> <tr> <td><?php echo intval($tax*100) / 100; ?></td> </tr> <tr> <td><?php echo intval($payable * 100) / 100; ?></td> </tr> <tr> <td><strong><?php echo intval($lp_surcharge * 100) / 100; ?></strong></td> </tr> <tr> <td><strong><?php echo intval($late_payable * 100) / 100; ?></strong></td> </tr> </table></td> </tr> <tr> <td height="140" colspan="2" align="center" valign="middle" bgcolor="#CC6633"><h4>Copy Rights: NGCP</h4></td> </tr> </table> </body> </html>

    Ideas 2

    <?php if (isset($_POST[‘submit’])) { $salary = $_POST[‘salary’]; if ($salary>50000) { $insurance = (20/100)*$salary; echo “Your salary is “.$salary . ” And Calculated insurance is “. $insurance; }elseif($salary>40000){ $insurance = (15/100)*$salary; echo “Your salary is “.$salary . ” And Calculated insurance is “. $insurance; }elseif($salary>30000){ $insurance = (10/100)*$salary; echo “Your salary is “.$salary . ” And Calculated insurance is “. $insurance;
  • CS310 Assignment 1 Solution and Discussion

    Solved
    2
    0 Votes
    2 Posts
    183 Views
    zareenZ

    Solution Code:

    <?php $header = "Virtual University of Pakistan"; $quicklist = "QUICK LINKS"; $about = "About Us"; $admissions = "Admissions"; $faculties = "Faculties"; $student = "Student"; $campuses = "Virtual Campuses"; $contact_us = "Contact Us"; $intro = "INTRODUCTION"; $content = "Pakistan’s first University based completely on modern Information and Communication Technologies."; $footer = "M.A Jinnah Campus, Defence Road,<br> Off Raiwind Road, Lahore"; ?> <html> <head> <title>Assignment No. 1 (Solution) - Fall 2019</title> </head> <body bgcolor="#CCCCCC"> <table width="1800" border="0" align="center" cellpadding="20" cellspacing="0"> <tr> <td height="200" colspan="2" align="center" valign="middle" bgcolor="#CC6633"><h1><?php echo $header; ?></h1></td> </tr> <tr> <td width="300" rowspan="2" align="center" valign="top" bgcolor="#FF9966"><h3><?php echo $quicklist; ?></h3> <a href="#"><?php echo $about; ?></a><br /><br /> <a href="#"><?php echo $admissions; ?></a><br /><br /> <a href="#"><?php echo $faculties; ?></a><br /><br /> <a href="#"><?php echo $student; ?></a><br /><br /> <a href="#"><?php echo $campuses; ?></a><br /><br /> <a href="#"><?php echo $contact_us; ?></a><br /><br /> </td> <td width="1500" height="50" align="center" valign="top" bgcolor="#FFDECE"><h3><?php echo $intro; ?></h3></td> </tr> <tr> <td height="500" align="left" valign="top" bgcolor="#FFDECE"><p><?php echo $content; ?></p></td> </tr> <tr> <td height="140" colspan="2" align="center" valign="middle" bgcolor="#CC6633"><h4><?php echo $footer; ?></h4></td> </tr> </table> </body> </html>

    Ideas 2

    <?php $header = "Virtual University of Pakistan"; $quicklist = "QUICK LINKS"; $about = "About Us"; $admissions = "Admissions"; $faculties = "Faculties"; $student = "Student"; $campuses = "Virtual Campuses"; $contact_us = "Contact Us"; $intro = "INTRODUCTION"; $content = "Pakistan’s first University based completely on modern Information and Communication Technologies."; $footer = "M.A Jinnah Campus, Defence Road,<br> Off Raiwind Road, Lahore"; ?> <html> <head> <title>Assignment No. 1 (Solution) - Fall 2019</title> </head> <body bgcolor="#CCCCCC"> <table width="1800" border="0" align="center" cellpadding="20" cellspacing="0"> <tr> <td height="200" colspan="2" align="center" valign="middle" bgcolor="#CC6633"><h1><?php echo $header; ?></h1></td> </tr> <tr> <td width="300" rowspan="2" align="center" valign="top" bgcolor="#FF9966"><h3><?php echo $quicklist; ?></h3> <a href="#"><?php echo $about; ?></a><br /><br /> <a href="#"><?php echo $admissions; ?></a><br /><br /> <a href="#"><?php echo $faculties; ?></a><br /><br /> <a href="#"><?php echo $student; ?></a><br /><br /> <a href="#"><?php echo $campuses; ?></a><br /><br /> <a href="#"><?php echo $contact_us; ?></a><br /><br /> </td> <td width="1500" height="50" align="center" valign="top" bgcolor="#FFDECE"><h3><?php echo $intro; ?></h3></td> </tr> <tr> <td height="500" align="left" valign="top" bgcolor="#FFDECE"><p><?php echo $content; ?></p></td> </tr> <tr> <td height="140" colspan="2" align="center" valign="middle" bgcolor="#CC6633"><h4><?php echo $footer; ?></h4></td> </tr> </table> </body> </html>
  • CS310 Quiz 2 Solution and Discussion

    Unsolved
    10
    0 Votes
    10 Posts
    533 Views
    zaasmiZ

    What SQL clause is used to restrict the rows returned by a query?
    55244ad6-5866-47d3-910c-3b933ed475c1-image.png

  • CS310 Assignment No. 03
 Solution and Discussion

    Unsolved
    2
    0 Votes
    2 Posts
    277 Views
    M

    Ideas Solution
    384b637f-d1b2-48b8-ade7-64dcae490f6f-image.png