Jump to content

wackyflik

New Members
  • Posts

    8
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

wackyflik's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. oh ok. it is like this. tbl_receipt will store all membership period of each members. for example, John has became our member for 5 years. meaning that, he has 5 membership periods because it is based on 1 year subscription. the only different are on start date and expiry date. therefore, i want to retrieve the latest expiry date of his membership period from tbl_receipt. what makes me a bit confusing is on this part especially the INTERVAL statement: AND tbl1.receipt_expiry_date <= CURDATE() + INTERVAL 3 DAY does the lines correct and able to fulfill my 2 objectives which are: 1. produce a name list for those who have expired their membership, and 2. produce a name list for those who will expire their membership in 3 days all these names will be displayed in a single page. thank you.
  2. Hi, I am trying to generate a name list for: 1. expired membership 2. membership that will expire in 3 days I have the SQL and technically it is working but I am a bit confusing whether my SQL statement is correct or wrong. Below is my SQL statement. Can someone give any opinion or comment on my SQL statement. Thank you. SELECT * FROM tbl_receipt tbl1 INNER JOIN ( SELECT tbl2.membership_num, MAX(tbl2.receipt_expiry_date) expiry_date FROM tbl_receipt tbl2 GROUP BY tbl2.membership_num) tbl3 ON tbl1.membership_num = tbl3.membership_num INNER JOIN tbl_registration tbl4 ON tbl1.membership_num = tbl4.membership_num INNER JOIN tbl_members tbl5 ON tbl1.membership_num = tbl5.membership_num AND tbl1.receipt_expiry_date = tbl3.expiry_date AND tbl1.receipt_expiry_date <= CURDATE() + INTERVAL 3 DAY ORDER BY $sortby ASC
  3. nope...nothing change...but how come these codes work? i used this code when trying jpgraph which is taken from phpfreaks. [code] <?php ini_set('display_errors', 1); error_reporting(E_ALL); session_start(); if(isset($_SESSION['user'])) { include('../config_default.php'); include('../jpgraph/src/jpgraph.php');  include('../jpgraph/src/jpgraph_bar.php'); $year = 2006; $sql = "SELECT COUNT(*) total, f.facultyInitial FROM attendance att INNER JOIN academic a ON att.academicNo = a.academicNo INNER JOIN program p ON a.programId = p.programId INNER JOIN faculty f ON p.facultyId = f.facultyId WHERE YEAR(att.attendanceDate) = $year GROUP BY (f.facultyId) ORDER BY f.facultyInitial"; $query = mysql_query($sql); $row = mysql_num_rows($query); if($row <> 0){ while($result = mysql_fetch_array($query)){ $data[] = $result['total']; $leg[] = $result['facultyInitial']; } $graph = new Graph(500,400,"auto"); $graph->SetScale("textint"); $graph->img->SetMargin(50,30,50,50); $graph->AdjBackgroundImage(0.4,0.7,-1); $graph->SetShadow(); $graph->xaxis->SetTickLabels($leg);// $bplot = new BarPlot($data);// $bplot->SetFillColor("lightgreen"); // Fill color $bplot->value->Show(); $bplot->value->SetFont(FF_ARIAL,FS_BOLD); $bplot->value->SetAngle(45); $bplot->value->SetColor("black","navy"); $graph->Add($bplot); $graph->title->Set("Numbers of Students"); $graph->xaxis->title->Set("Faculty"); $graph->yaxis->title->Set("No. of Students"); $graph->Stroke(); } else{ echo "Database is empty"; } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <br /> JpGraph 1 </body> </html> <?php } else{ echo "<br><br><center><font face=\"Georgia, Times New Roman, Times, serif\">Warning: You are trying accessing restricted page.</font></center>"; header("Refresh:2, url='../auth/login_form.html'"); } ?> [/code]
  4. i've got some weird output like symbols when run these codes. what happened actually?? [code] <?php session_start(); if(isset($_SESSION['user'])) { $dateId = $_GET['id']; function generateGraph($year, $month){ include('../config_default.php'); include('../jpgraph/src/jpgraph.php');  include('../jpgraph/src/jpgraph_bar.php'); $sql = "SELECT f.facultyInitial,         COUNT(*) AS Total FROM attendance att INNER JOIN academic a ON att.academicNo = a.academicNo INNER JOIN program p ON a.programId = p.programId INNER JOIN faculty f ON p.facultyId = f.facultyId WHERE MONTH(att.attendanceDate) = $month AND YEAR(att.attendanceDate) = $year GROUP BY f.facultyInitial ORDER BY f.facultyInitial"; $query = mysql_query($sql); $row = mysql_num_rows($query); if($row <> 0){ while($result = mysql_fetch_array($query)){ $data[] = $result['total']; $leg[] = $result['facultyInitial']; } $graph = new Graph(500,400,"auto"); $graph->SetScale("textint"); $graph->img->SetMargin(50,30,50,50); $graph->AdjBackgroundImage(0.4,0.7,-1); $graph->SetShadow(); $graph->xaxis->SetTickLabels($leg);// $bplot = new BarPlot($data);// $bplot->SetFillColor("lightgreen"); // Fill color $bplot->value->Show(); $bplot->value->SetFont(FF_ARIAL,FS_BOLD); $bplot->value->SetAngle(45); $bplot->value->SetColor("black","navy"); $graph->Add($bplot); $graph->title->Set("Numbers of Students"); $graph->xaxis->title->Set("Faculty"); $graph->yaxis->title->Set("No. of Students"); $graph->Stroke(); } else{ echo "<center><font face=\"Georgia, Times New Roman, Times, serif\" color=\"#000000\">Sorry, no record is found.</font></center>"; } } function splitDate($dateId){ $tempDate = explode('-', $dateId); /* * add 0 in front of the month if * month parameter is between 1 and 9 */ if($tempDate[1] >= 1 && $tempDate[1] <= 9) $tempDate[1] = "0" . $tempDate[1]; else $tempDate[1] = $tempDate[1]; generateGraph($tempDate[0], $tempDate[1]); } if(isset($dateId)){ splitDate($dateId); } } else{ echo "<br><br><center><font face=\"Georgia, Times New Roman, Times, serif\">Warning: You are trying accessing restricted page.</font></center>"; header("Refresh:2, url='../auth/login_form.html'"); } ?> [/code]
  5. like this, i am using CSS for my layout design which is totally different from the previous website. here is the hyperlinks that i have: [code]<div id="list-menu"> <ul> <li><a href="default_menu.html" target="content">Home</a></li> <li><a href="about_us.html" target="content">About Us</a></li> <li><a href="../faculty/form_faculty.php?op=add" target="content">Add New Faculty</a></li> <li><a href="../faculty/view_faculty.list.php" target="content">Lists of Faculties</a></li> <li><a href="../program/form_program.php?op=add" target="content">Add New Program</a></li> <li><a href="../program/view_program.list2.php" target="content">Lists of Programs</a></li> <li><a href="../student/form_student.php" target="content">Add New Student</a></li> <li><a href="../attendance/form_attendance.php" target="content">Add New Attendance</a></li> <li><a href="../attendance/view_all_bydate.php" target="content">View Attendance List</a></li> </ul> </div>[/code] if u can see, there is a target in the <a> tag which is [b][u]content[/u][/b]. i want when i click any of the hyperlinks, the page will be displayed in the: [code] <div id="content"> <!-- display webpages here --> </div>[/code]
  6. how do i open any webpages by clicking hyperlinks located at the left side and the page will be displayed in the <div="content"> tag instead of using <iframe>? here is my code: [code]<body> <div id="container"> <div id="banner"> <h1>Banner</h1> </div> <div id="nav"> <p>Welcome, <?php echo $_SESSION['user']; ?> [<a href="../auth/logout_process.php">Sign Out</a>]</p> <p> <div id="list-menu"> <ul> <li><a href="default_menu.html" target="content">Home</a></li> <li><a href="about_us.html" target="content">About Us</a></li> <li><a href="../faculty/form_faculty.php?op=add" target="content">Add New Faculty</a></li> <li><a href="../faculty/view_faculty.list.php" target="content">Lists of Faculties</a></li> <li><a href="../program/form_program.php?op=add" target="content">Add New Program</a></li> <li><a href="../program/view_program.list2.php" target="content">Lists of Programs</a></li> <li><a href="../student/form_student.php" target="content">Add New Student</a></li> <li><a href="../attendance/form_attendance.php" target="content">Add New Attendance</a></li> <li><a href="../attendance/view_all_bydate.php" target="content">View Attendance List</a></li> </ul> </div> </p> </div> <div id="content"> <!-- display webpages here --> </div> <div id="footer"> <p> Master of Science in Information Technology <br /> ITT 751 - Advanced Internet &amp; Web Programming <br /> Copyright &copy; 2006 </p> </div> </div> </body>[/code]
  7. [code]class Users {     var $u_id;          function Users()     {         // nothing     }                  function addUsers($u_id, $u_name, $u_icno, $u_gender, $u_race, $u_design, $u_address, $u_phoneno, $u_usrname, $u_pwd)     {         global $ecisDB;                      $this->u_id = $u_id;                      $sql = "INSERT INTO users (usersId, usersName, usersIcNo, usersGender, usersRace, usersDesignation, usersAddress, usersPhoneNo, usersUsername, usersPassword)                VALUE ('$u_id', '$u_name', '$u_icno', '$u_gender', '$u_race', '$u_design', '$u_address', '$u_phoneno', '$u_usrname', '$u_pwd')";         $query = $ecisDB->query($sql) or die(mysql_error());                  //pass user id to child classes: 1. clerk 2.doctor 3. nurse         return $u_id;     }          function loadDesignation()     {         $designation = array("Clerk", "Doctor", "Nurse");         return $designation;     }          function loadGender()     {         $gender = array("Female", "Male");         return $gender;     }          function loadRace()     {         $race = array("Chinese", "Indian", "Malay", "Others");         return $race;     }          function checkString($string)     {         $pattern = "/^[a-zA-Z\.\ ]+$/";         //$pattern = "/^[abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\.\ ]+$/";         if(preg_match($pattern, $string))             return true;         else             return false;     }          function checkIcNo($u_icno)     {         if(is_numeric($$u_icno)){             if(!strlen($$u_icno)==12)                 return true;             else                 return false;         }         else             return false;     }          function checkUName($u_usrname)     {         global $ecisDB;                 $sql = "SELECT * FROM users WHERE usersUsername=\"$u_usrname\"";         $query = $ecisDB->query($sql); //$result         $count = $ecisDB->sql_count($query); //$result                  if ($count == 0)         {             return true;         }         else         {             return false;         }     }          function checkPwd($u_pwd, $u_repwd)     {         if($u_pwd == $u_repwd)         {             return true;         }         else         {             return false;         }     }          function usersLogin($u_usrname, $u_pwd)     {         global $ecisDB;         session_start();                 $sql = "SELECT * FROM Users WHERE usersUsername = \"" . $u_usrname . "\" AND usersPassword = \"" . $u_pwd . "\"";         $query = $ecisDB->query($sql);         $count = $ecisDB->sql_count($query);         $row = $ecisDB->fetch_array($query);  //$query                  if ($count != 0)         {             $_SESSION['u_id'] = $row['usersId'];             $_SESSION['u_name'] = $row['usersName'];             //$_SESSION['level'] = $row['usersDesignation'];             header("Location: ../index.php");         }         else{             header("Location: ../index.php");         }     }          function usersLogout($goto="")     {         session_start();         $_SESSION['u_id'] = '';         $_SESSION['u_name'] = '';         if(!empty($goto)){             header("Location: ../" . $goto);         }     }          function &getUserInfo($u_id)     {         global $ecisDB;         $sql = "SELECT * FROM Users WHERE usersId = " . $u_id;         $query = $ecisDB->query($sql) or die (mysql_error());         $row = $ecisDB->fetch_array($query);         return $row;     }          function updateUsers($u_id, $u_name, $u_icno, $u_gender, $u_race, $u_design, $u_address, $u_phoneno)     {         global $ecisDB;         $sql = "UPDATE Users SET usersName = \"$u_name\",                                  usersIcNo = \"$u_icno\",                                  usersGender = \"$u_gender\",                                  usersRace = \"$u_race\",                                  usersDesignation = \"$u_design\",                                  usersAddress = \"$u_address\",                                  usersPhoneNo = \"$u_phoneno\"                                  WHERE usersId = " . $u_id;         $query = $ecisDB->query($sql);     }          function updatePassword($u_id, $new_pwd1)     {         global $ecisDB;         $sql = "UPDATE Users SET usersPassword = \"$new_pwd1\" WHERE usersId = " . $u_id;         $query = $ecisDB->query($sql);     } } class Clerk extends Users {     function Clerk()     {         //nothing     }          function addClerk($u_id)     {         global $ecisDB;         $clerkId = $this->addUsers($u_id, $u_name, $u_icno, $u_gender, $u_race, $u_design, $u_address, $u_phoneno, $u_usrname, $u_pwd);         $sql = "INSERT INTO Clerk (clerkId) VALUE ('$u_id')";         $query = $ecisDB->query($sql) or die(mysql_error());     } } [/code] there are 2 classes: Users is a parent class and Clerk is a child class. in parent class there is a function named addUsers with several arguments and 1 of it is user id (u_id). i want to pass the user id (u_id) from addUsers to addClerk. how to that? thank you.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.