Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- this is what i have thus far
- <?php
- @session_start();
- $hostname = "localhost";
- $username = "root";
- $password = "hayden";
- $database = "ecng3020";
- $con = mysql_connect("$hostname","$username","$password");
- if (!$con)
- {
- die('Could not connect: ' . mysql_error());
- }
- mysql_select_db("$database", $con);
- $q="SELECT * FROM rules Where type ='course_option' ";
- if ($result_2=mysql_query($q))
- {
- echo"nice";
- }
- else
- {
- echo"shit";
- }
- while($row = mysql_fetch_assoc($result_2))
- {
- extract($row);
- //echo "<p>$parameters</p>";
- $e=explode(",",$parameters);
- //print_r($e);
- $_SESSION['parm']=$e;
- //$id=$_SESSION['username'];
- //$_SESSION['courses']=$_POST['coursecode_1'];
- //print_r($_SESSION['courses']);
- @$code= $e;
- if( is_array($code))
- {
- //$sum= array();
- while (list ($key, $val) = each ($code))
- {
- echo $val;
- $w="SELECT * FROM student_course WHERE course_status='pass' AND course_code='$val' AND
- id_no=806000169";
- if ($result1=mysql_query($w))
- {
- echo"nice";
- }
- else
- {
- echo"shit";
- }
- while($row1 = mysql_fetch_assoc($result1))
- {
- extract($row1);
- echo "<p>$course_status</p>";
- echo "<p>$course_code</p>";
- //$first=array();
- $first[]=$course_code;
- //echo $y;
- //echo "<p>hi</p>";
- //print_r($first);
- }
- }
- }
- print_r($first);
- $_SESSION['first']=$first;
- }
- function form()
- {
- $hostname = "localhost";
- $username = "root";
- $password = "hayden";
- $database = "ecng3020";
- $courses_options = "";
- $con = mysql_connect("$hostname","$username","$password");
- if (!$con)
- {
- die('Could not connect: ' . mysql_error());
- }
- mysql_select_db("$database", $con);
- $courses_options .= "<option value=\"NULL\">Course :</option>\n";
- $try="Select course_code,course_name FROM courses";
- $rsrcResult = mysql_query($try);
- $courses_options .= "<select name=coursecode_1[] size=4 multiple>";
- while($row = mysql_fetch_row($rsrcResult)) {
- $strA=$row[0];
- $strB=$row[1];
- $courses_options .= "<option value=\"$strA\">$strB</option>\n";
- }
- $courses_options .= "</select>";
- echo <<<EOB
- <form method=post action=''>
- <p>$courses_options</p>
- <p>
- <input type="submit" name="submit" value="Submit" />
- <input type="reset" name="Reset" value="Cancel" />
- </p>
- </form>
- EOB;
- }
- form();
- if ($_POST['submit'] == 'Submit')
- {
- $hostname = "localhost";
- $username = "root";
- $password = "hayden";
- $database = "ecng3020";
- $con = mysql_connect("$hostname","$username","$password");
- if (!$con)
- {
- die('Could not connect: ' . mysql_error());
- }
- mysql_select_db("$database", $con);
- //$id=$_SESSION['username'];
- @$code= $_POST['coursecode_1'];
- $_SESSION['courses']=$_POST['coursecode_1'];
- //print_r($_SESSION['courses']);
- if( is_array($code))
- {
- //$sum= array();
- while (list ($key, $val) = each ($code))
- {
- //echo $val;
- //$second[]=$_POST['coursecode_1'];
- //print_r($_POST['coursecode_1']);
- $_SESSION['second']=$_POST['coursecode_1'];
- }
- }
- }
- $new=array_merge($_SESSION['second'],$_SESSION['first']);
- print_r($new);
- $hostname = "localhost";
- $username = "root";
- $password = "hayden";
- $database = "ecng3020";
- $con = mysql_connect("$hostname","$username","$password");
- if (!$con)
- {
- die('Could not connect: ' . mysql_error());
- }
- mysql_select_db("$database", $con);
- $q="SELECT * FROM rules Where type ='course_option' AND label='comms courses' ";
- if ($result_2=mysql_query($q))
- {
- echo"nice";
- }
- else
- {
- echo"shit";
- }
- ($row = mysql_fetch_assoc($result_2))
- extract($row);
- //echo "<p>$parameters</p>";
- $o=explode(",",$parameters);
- //print_r($e);
- for ($i=0;$i<count($new);$i++)
- {
- if ($new[$i]==$o[$i])
- {
- echo "<p>option complete</p>";
- }
- }
- ?>
Add Comment
Please, Sign In to add comment