Jump to content

StuHannah

Members
  • Posts

    14
  • Joined

  • Last visited

Everything posted by StuHannah

  1. SIMS.net is a School Information Management System, not the game. The site is nothing to do with me. I was simply looking at a way of developing my own internal booking system, taking away the need to use paper, and without costing anything but my time. All I was doing was trying to learn along the way. Thanks anyway and best wishes. Stuart
  2. This table contains all of the MIS Data from SIMS.net. The report that runs grabs the following information: Room Name Period Class name Staff Code Room1 MonA:1 7L/IT1 ASm Room1 MonA:2 8R/Ma1 PKa CREATE TABLE `tbl_misdata` ( `MIS_ID` int(11) NOT NULL, `MIS_Room` varchar(200) NOT NULL, `MIS_Period` varchar(200) NOT NULL, `MIS_Class` varchar(200) NOT NULL, `MIS_Staff` varchar(200) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; This table contains all the available periods available on the MIS System. (These are static so I’ve extracted them from the SIMS report) CREATE TABLE `tbl_periods` ( `Period_Name` varchar(100) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; This table contains the list of rooms. Again these are manually added to the DB. If we wanted a new room, I would add it to the system manually, and the edit the report to include this in the data export. CREATE TABLE `tbl_rooms` ( `RM_ID` int(11) NOT NULL, `RM_Name` varchar(100) NOT NULL, `RM_Desc` varchar(200) NOT NULL, `RM_Available` varchar(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; This table contains the list of rooms. Again these are manually added to the DB. If we wanted a new room, I would add it to the system manually, and the edit the report to include this in the data export. CREATE TABLE `tbl_weeks` ( `Week_ID` int(11) NOT NULL, `week_Name` varchar(100) NOT NULL, ) ENGINE=InnoDB DEFAULT CHARSET=latin1; This table will eventually have the extra bookings that have been added by the end user. CREATE TABLE `tbl_bookings` ( `Booking_` int(11) NOT NULL, `Booking_Room` varchar(200) NOT NULL, `Booking_Period` varchar(200) NOT NULL, `Booking_Week` varchar(200) NOT NULL, `Booking_User` varchar(200) NOT NULL, `Booking_Class` varchar(200) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; Brief overview of some of the pages Admin Side SetupWeeks.php – Loops through 52 weeks ahead of the week it has been opened (So gets used once a year) and has checkboxes with A/B/H as the options. A = Week A, B = Week B and H = Holiday. The idea with this is that when the main page loads, it will get the current week we are on; query the database to see what sort of week we are on, then pull that week’s MIS information. NewRoom.php – Creates a new room in the tbl_rooms table, where it is given details such as number of pc’s etc. End User Index.php – Page loads, connecting to the DB. Check what week we are on, starting at Monday. Once it has determined the week, it checks the database to see what week it is. If it is an A week, it will query filtering all the A week MIS information, if it’s a B Week, same again checks for the B week information. If the week is a H, it simply lets the user know it’s a holiday week. Bit I am up to! Once the MIS data has been brought to the end user, it will print the current information on the screen, however at present it will print everything, but if there is a gap i.e. there isn’t any MIS data available as the period is free, it doesn’t print that it’s free, as I know it doesn’t have the information, so it’ won’t know – There are always 5 sessions a day, so was thinking of having a variable with that states and for each result i.e. $i=5 for each monA:$i <5) print the result, if (!$result)then print to say it’s free. Hope this will help, and provide you with enough information. Apologies for not providing all information earlier, burning the candle at both ends at the moment.
  3. Yeah we run a two week cycle so have two lots of data, week a data and week b all in one table, the idea is that when the user loads up the page, it will determine what week it is and query the data only from that week. Hope that makes sense. Stuart
  4. The MIS is SIMS and I am unsure if there is an API, I'm simply pulling data through the command reported into a csv the have a script to import this to the MySQL mis data table.
  5. They mean the week and session. MONA:1 = Monday of Week A, session 1. MONB:1 = Monday of Week B, Session 1.
  6. Thanks for the reply. Just realised I didn't say MySQLi, was just Pseudo'ing it out off the top of my head as an idea. Below is the table structure: tbl_misdata is the data straight from the MIS system tbl_periods are all the periods we use i.e. MONA:1, MONA:2 (A being the week we are on and the number is the session) tbl_rooms the list of rooms we have to book. tbl_weeks list of weeks and wether they are A week, B week or a Holiday. So my Pseudo, to help explain it: In the admin side, we specify the weeks in the DB so they are A/B/H When the page loads, it checks what week we are on by date and then queries the DB to see what type of week this is. Once we determine week, we are able to loop through the misdata where it matches the week (so if we return an A week, we want all the data that matches MonA% in the query. Hope this helps! #readytotakeabeating CREATE TABLE `tbl_bookings` ( `Booking_` int(11) NOT NULL, `Booking_Room` varchar(200) NOT NULL, `Booking_Period` varchar(200) NOT NULL, `Booking_Week` varchar(200) NOT NULL, `Booking_User` varchar(200) NOT NULL, `Booking_Class` varchar(200) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; CREATE TABLE `tbl_misdata` ( `MIS_ID` int(11) NOT NULL, `MIS_Room` varchar(200) NOT NULL, `MIS_Period` varchar(200) NOT NULL, `MIS_Class` varchar(200) NOT NULL, `MIS_Staff` varchar(200) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; CREATE TABLE `tbl_periods` ( `Period_ID` int(11) NOT NULL, `Period_Name` varchar(100) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; CREATE TABLE `tbl_rooms` ( `RM_ID` int(11) NOT NULL, `RM_Name` varchar(100) NOT NULL, `RM_Desc` varchar(200) NOT NULL, `RM_Available` varchar(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; CREATE TABLE `tbl_weeks` ( `Week_ID` int(11) NOT NULL, `Week_Name` varchar(200) NOT NULL, `Week_Type` varchar(1) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
  7. Evening (Or Morning wherever you are)! Looking for a bit of help as what I am trying to achieve I am unsure if its possible, so I am asking the brains on PHPFreaks. Basically I am developing a booking system, and I have managed to get the system to store the data from the MIS system, however if there is a free session it isn't recorded. For instance, we have 5 sessions a day, but on Mondays the room only has 4 pieces of information recorded as one of them is free. So below is an example of the data within the MIS Data: MIS_ID MIS_Session MIS_Staff MIS_Group 1 MONA:1 ABC GP1 2 MONA:2 DEF GP2 3 MONA:4 GHI GP3 I am able to pull all this information, however it will only pull 4 piece (as I know there is only 4 in the DB) is there anyway to maybe specify within a variable for instance $sessions = 5; then get it so loop through until the values meet: while($session <= mysql_num_rows); Hoping someone can point me in the right direction as I am so close, but feel so far! Thank you in advance to anyone who has any valuable input! Kind Regards, Stuart
  8. Thank you so much for all your help, i've been able to understand your code and adapt elements to make this work for the system I am developing.. I cannot thank you enough. Stuart
  9. Morning, I am looking for some help. What I am trying to do is for each week of the year assign a letter to it, either an A or B week for rotas. I am able to print on screen the weeks for 52 weeks and this part works fine and lists the weeks, and what I want to do from there is use a combobox next to each date so we can allocate a week to it selecting either A or B. The code I have been using and working on I have put on the bottom. Just come a bit stuck and need a little help please. This bit gets me all of the weeks for the next 52 weeks. for($i=1; $i<=52; $i++){ $num = date("Y-m-d", strtotime('Last Monday +'.$i.' week')); echo $num I am now trying to get the below working and can't figure it out... // This is the part to read the submission <?php if(isset($_POST['formSubmit']) ) { $varWeekNow = $_POST['{$num}']; // SQL Bit $sql = "INSERT INTO weeks (Date, Week) VALUES ('$num', '$varWeekNow')"; if (mysqli_query($link, $sql)) { echo "New record created successfully"; } else { echo "Error: " . $sql . "<br>" . mysqli_error($link); }} ?> // this is the part to print the weeks and a dropbown box. <?php for($i=1; $i<=52; $i++){ $num = date("Y-m-d", strtotime('Last Monday +'.$i.' week')); echo "<form action=\"index.php\" method=\"post\"> What is this week? " . $num . " <select name=\"{$num}\"> <option value=\"\">Select...</option> <option value=\"A\">A Week</option> <option value=\"B\">B Week</option> </select> <input name=\"formSubmit\" type=\"hidden\" value=\1\" /> <input name=\"submit\" type=\"submit\" /> </p></form>"; } ?> Kind Regards, Stuart
  10. Hi Everyone, I am looking for some help with creating a loop in PHP. Basically my table has columns named Mon1, Mon2, Mon3 all the way up to 50. I have pasted my code below, but I don't think it's a good way I am doing it. I have thought about trying to use the code (below the old code) <?php $result = mysqli_query($mysqli, $query); //while ($row = mysqli_fetch_array($result)) { // echo $row[0] . ': ' . $row[1] . ' ' . $row[2]; // echo '<br />'; //} while ($row = mysqli_fetch_array($result)) { echo $row['MON1'] . ' - ' . $row['MON2'] . ' - ' . $row['MON3'] . ' - ' . $row['MON4'] . ' - ' . $row['MON5']; echo '<br />'; echo $row['TUE1'] . ' - ' . $row['TUE2'] . ' - ' . $row['TUE3'] . ' - ' . $row['TUE4'] . ' - ' . $row['TUE5']; echo '<br />'; echo $row['WED1'] . ' - ' . $row['WED2'] . ' - ' . $row['WED3'] . ' - ' . $row['WED4'] . ' - ' . $row['WED5']; echo '<br />'; echo $row['THU1'] . ' - ' . $row['THU2'] . ' - ' . $row['THU3'] . ' - ' . $row['THU4'] . ' - ' . $row['THU5']; echo '<br />'; echo $row['FRI1'] . ' - ' . $row['FRI2'] . ' - ' . $row['FRI3'] . ' - ' . $row['FRI4'] . ' - ' . $row['FRI5']; echo '<br />'; } mysqli_free_result($result); mysqli_close($mysqli); ?> <?php $result = mysqli_query($mysqli, $query); $i = 1; while ($1 < 50) { while ($row = mysqli_fetch_array($result)) { echo $row['MON$i']; } } mysqli_free_result($result); mysqli_close($mysqli); ?> Kind Regards, Stuart
×
×
  • 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.