48 users online (0 members and 48 guests)  


  Results 1 to 2 of 2

Related

  1. Replies: 1
  2. Replies: 11
  3. Replies: 2
  1. #1
    tom777's Avatar
    New User

    Status
    Offline
    Join Date
    Mar 2004
    Posts
    1

    Question Need help with PHP where one drop update the next with info from Mysql

    I have no clue where to start with this issue. Because I have a PHP webpage which some one else wrote.

    But when I chose a department it will so all the users in the database and what I want is to just show the people with in that depart ment.

    I can past code here but not sure if it is the right one.

    Where is the index php file

    <?
    require('config.inc.php3');
    require('lib.inc.php3');
    require('dept.inc.php3');
    require('shift.inc.php3');
    if (isset($submit) && ($submit != 'When')) {
    if (!isset($dept)) {
    page_header('ERROR');
    php_die('Internal ERROR $dept is not set');
    }
    Header("Location: table.php3?dept=$dept&weekno=$weekno&noadmin=$noadmin&showmy=$showmy");
    exit;
    }
    page_header('Welcome to phpSched');
    $admin = is_admin($REMOTE_USER);
    ?>
    <FORM>
    <TABLE border="0">
    <TR valign="top" align="center"><TD>
    <TABLE border="1">
    <TR><TH colspan="2" bgcolor="navyblue">View department schedule</TH></TR>
    <TR bgcolor="#ffffcc"><TH>Deparment</TH><TH>Week</TH></TR>
    <TR bgcolor="#cccccc">
    <TD align="center"><? show_dep_select(); ?></TD>
    <TD align="center"><? show_week_select(); ?></TD>
    </TR>
    <?
    if ($admin) {
    ?>
    <TR align="center" bgcolor="#cccccc">
    <TD><INPUT type="checkbox" name="noadmin" value="1"></TD>
    <TD>Regular view</TD>
    </TR>
    </TABLE>
    <INPUT type="submit" name="submit" value="Edit TimeTable"><BR>
    <?
    } else {
    ?>
    <TR align="center" bgcolor="#cccccc">
    <TD><INPUT type="checkbox" name="showmy" value="1"></TD>
    <TD>Show my shifts only</TD>
    </TR>
    </TABLE>
    <INPUT type="submit" name="submit" value="Show TimeTable">
    <?
    }
    ?>
    </TD><TD>
    </FORM>
    <FORM>
    <TABLE border="1">
    <TR><TH colspan="2" bgcolor="navyblue">Lookup user's schedule</TH></TR>
    <TR bgcolor="#ffffcc"><TH>Username</TH><TH>Week</TH></TR>
    <TR bgcolor="#cccccc">
    <TD><? show_allusers_select('user', $user); ?></TD>
    <TD><? show_week_select(); ?></TD>
    </TR>
    </TABLE>
    <INPUT type="submit" name="submit" value="When">
    </TD></TR></TABLE>
    </FORM>
    <BR><BR>
    <?
    $depts = get_dept_names();
    if ($submit != 'When') {
    $time = time();
    $date = getdate($time);
    $today = $date['wday'] - $CONFIG['weekfrommon'];
    if ($today < 0)
    $today += 7;
    $todayweek = get_week_number($time);
    $date = getdate($time+24*60*60);
    $tomorrow = $date['wday'] - $CONFIG['weekfrommon'];
    if ($tomorrow < 0)
    $tomorrow += 7;
    $tomorrowweek = get_week_number($time+24*60*60);
    for(reset($depts); $dept = key($depts); next($depts)) {
    show_dept_sched($dept, $today, $today, $todayweek, 0, 0);
    }
    print '<BR>';
    for(reset($depts); $dept = key($depts); next($depts)) {
    show_dept_sched($dept, $tomorrow, $tomorrow, $tomorrowweek, 0,
    0);
    }
    } else {
    ?>
    <H1><FONT color="blue">These are the working hours for <? print $user; ?> for <? print get_week_byno($weekno);?></FONT></H1>
    <?
    for(reset($depts); $dept = key($depts); next($depts)) {
    $wdays = array();
    $shifts = get_user_shifts($user, $dept, $weekno);
    for (reset($shifts); $shift = current($shifts); next($shifts)) {
    if (!$wdays[$shift['weekday']]) {
    show_dept_sched($dept, $shift['weekday'],
    $shift['weekday'], $weekno, 0, 0,
    $user);
    }
    }
    }
    }
    page_footer();
    ?>

  2. #2
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    I dont think this is the correct code you need to be looking at.

    Look for one with a statement like "SELECT * FROM" for similar.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?



Tags for this Thread