Jump to content

SkyRanger

Members
  • Posts

    738
  • Joined

  • Last visited

Posts posted by SkyRanger

  1. I am trying to convert the output to month days:

     

    $sql = "SELECT * FROM ".$prefix."_holiday_countdown";
        $result = $db->sql_query($sql);
        while ( $row = $db->sql_fetchrow($result) )
        {
    $hmonth = $row['hmonth'];
    $hday = $row['hday'];
    $hyear = $row['hyear'];
    $holiday = $row['hholiday'];
    }
    
    $target = mktime(0, 0, 0, $hmonth, $hday, $hyear) ;
    $today = time () ;
    $difference =($target-$today) ;
    $days =(int) ($difference/86400) ;
    $content = " $days till ".$holiday;

     

    I am trying to figure out how to get it to convert to ? months ? days till $holiday

  2. Ok, Guess I missed something:

     

    $sql = "SELECT * FROM ".$prefix."_bus_monitor";
    $result = $db->sql_query($sql);
    
    $arrNotRunning = array();
    
    while ( $row = $db->sql_fetchrow($result) )
    {
       if(strcasecmp($row['brun'], 'running') != 0){
           $arrNotRunning['status'][] = $row['brun'];
           $arrNotRunning['school'][] = $row['bschool'];
       }
    if(count($arrNotRunning) == 0) {
       $content = "All buses running normally.<br />";
    } else {
       $content = "The following buses are delayed or canceled: <br />";
       $loopCount = count($arrNotRunning['status']);
       for($i = 0; $i < $loopCount; $++i){
         $content .= "Bus ".$i.": ".$arrNotRunning['school'][$i]." ".$arrNotRunning['status'][$i]."<br/>";
       } 

  3. Well I thought I had it, sorry for being a pain guys.  I am also trying to get some more data to output with the delayed/canceled status.

     

    What I am trying to get is:

     

    Bus no 1:  School Name  Delayed

    Bus no 2:  School Name  Canceled

    etc.

     

     

    I can get the school name to display but for some reason, it is only displaying 1 school name for all entries.

     

    I tried a number of different things, and so far...all wrong...lol

     

    $arrNotRunning = array();
    
    while ( $row = $db->sql_fetchrow($result) )
    {
       if(strcasecmp($row['brun'], 'running') != 0) $arrNotRunning[] = $row['brun'];
       $bschool = $row['bschool'];
    }
    if(count($arrNotRunning) == 0) {
       $content = "All buses running normally.<br />";
    } else {
       $content = "The following buses are delayed or canceled: <br />";
       $intBus = = 1;
       foreach($arrNotRunning as $strBusStatus){
         $content .= "Bus ".$intBus.": ".$bschool." ".$strBusStatus."<br/>";
         $intBus++;
       }
    }
    ?>
    

  4. $sql = "SELECT * FROM ".$prefix."_bus_monitor";
        $result = $db->sql_query($sql);
        while ( $row = $db->sql_fetchrow($result) )
        {
    $busstatus = $row['brun'];
    }

     

    So what I am trying to do is get it to say if no buses are delayed then post:

     

    All buses running normally.

     

    But if there are a buses delayed or canceled like in the example above:

     

    bus 2 - delayed

    bus 5 - canceled

  5. I am having a small problem  I am trying to pull info from my database when something changes.

     

    Example 1:

    $busstatus = $bstat;
    
    if ($busstatus = "running)
    echo "All buses are running";
    else
    echo "The following buses are delayed or canceled";
    

     

    In the database I would have:

     

    bus 1 - running

    bus 2 - running

    bus 3 - running

    bus 4 - running

    bus 5 - running

     

    So if all the buses are running it would say "All buses running"

    but if one of them got changed:

     

    bus 1 - running

    bus 2 - delayed

    bus 3 - running

    bus 4 - running

    bus 5 - canceled

     

    I am trying to get the else statement to say:

    The following buses are delayed or canceled

     

     

     

  6. Not sure if this is possible.  In my database I have A list of schools and the towns they are in.

     

    Example:

     

    School 1    town 1

    School 2    town 1

    school 3    town 2

    school 4    town 2

    school 5    town 1

     

    I can get it to display  just as I have it above,  I was wondering if there was a way that I can do:

     

    town 1

    -------

    School 1

    School 2

    School 5

     

    town 2

    -------

    school 3

    school 4

  7. After rewriting the code once again, I finally figured it out.

     

              if (isset($_POST[submit])) {
       
       foreach ($_POST as $key) {
              $id=$key[id];
              $mid=$key[mid];
    include "../inc/dbconnect.inc.php";
             mysql_query("UPDATE menu set mid = '$mid' where id = '$id'") or die(mysql_error());;
    
       }
    }
    
    
    ...........
    connect code for DB + rest of form.............
    ...........
    
    
    
    
    while($rows=mysql_fetch_array($result)){
    $id = $rows['id'];
    $mid = $rows['mid'];
    ?>
    <tr>
    <td align="center"><? echo $rows['id']; ?></td>
    <?php
    print	"<input type='hidden' name =".$id."[id] value =".$id.">";
    ?>
    <td align="center"><?php
    echo "<input type='text' size='2' name=\"".$id."[mid]\" value=".$mid.">";
    ?>
    </td>
    <td align="center"><? echo $rows['msect']; ?></td>
    <td align="center"><? echo $rows['mtialt']; ?></td>
    <td align="center"><? echo $rows['mpgim']; ?></td>
    </tr>
    <?php
    }
    
    .......+ rest of form
    

×
×
  • 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.