Ignore:
Timestamp:
02/26/07 12:59:57 (18 years ago)
Author:
Daniela Dorner
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/datacenter/db/include.php

    r8199 r8333  
    223223
    224224    return $max;
     225}
     226
     227function GetMaxDate($field, $table, $host, $user, $pw, $db)
     228{
     229    $db_id = mysql_connect($host, $user, $pw);
     230    if ($db_id==FALSE)
     231    {
     232            printf("mysql_connect returned the following error:<br>");
     233            printf("%s<br>", mysql_error());
     234            die("");
     235    }
     236
     237    $query  = "SELECT DATE_FORMAT(if(MAX(" . $field . ")<'13:00:00', MAX(" . $field . "), ADDDATE(MAX(" . $field . "), INTERVAL +1 DAY)), '%Y-%m-%d') FROM " . $db . "." . $table;
     238    $result = mysql_query($query);
     239    if (!$result)
     240        return "0";
     241
     242    $row = mysql_fetch_row($result);
     243
     244    $maxdate = $row[0];
     245
     246    mysql_free_result($result);
     247    mysql_close($db_id);
     248
     249    return $maxdate;
    225250}
    226251
Note: See TracChangeset for help on using the changeset viewer.