Parašė Narysx· 2009 Kov. 24 18:03:55
#1
Ka reiškia tokie kodai?
public function getByDay($date = NULL) {
if ($date == NULL) {
$date = strtotime(date("Y-m-d", time()));
} else {
$date = strtotime(date("Y-m-d", $date));
}
$from = $date;
$to = $date + (60*60*24);
$sql = "SELECT count(*) as count, DATE_FORMAT(FROM_UNIXTIME(ga_date), '%Y-%m-%d') AS date, ga_date
Čia man tokioj stats sistemoj rodo viską pagal tokią datą:
237760116. Ji būna surašyta
mysql stulpelyje
ga_date, o man reikia, kad rodytų viską pagal tokią datą:
2009-03-24. Ji surašyta stulpelyje
kada...
Redagavo Narysx· 2009 Kov. 24 18:03:07
Parašė sniuff· 2009 Kov. 24 18:03:58
#2
echo date("Y-m-d",$data['ga_date']);
Parašė Narysx· 2009 Kov. 24 18:03:52
#3
Ne taip supratai... Nu gal ir mano klaida, kad iškrato viso kodo nedaviau. Va:
<?php
class Results {
public function __construct() {
$this->db = $GLOBALS["db"];
}
public function getAll() {
$sql = "SELECT ga_id, ga_date, ga_home_score, ga_away_score, ga_home_id, h.te_city as ho, ga_away_id, a.te_city as aw
FROM ".TABLE_GAMES.", ".TABLE_TEAMS." as h, ".TABLE_TEAMS." as a WHERE ga_home_id=h.te_id AND ga_away_id=a.te_id
ORDER BY ga_date DESC";
$results = $this->db->getAll($sql);
return $results;
}
public function getByDay($date = NULL) {
if ($date == NULL) {
$date = strtotime(date("Y-m-d", time()));
} else {
$date = strtotime(date("Y-m-d", $date));
}
$from = $date;
$to = $date + (60*60*24);
$sql = "SELECT ga_id, ga_date, ga_home_score, ga_away_score, ga_home_id, h.te_city as ho, ga_away_id, a.te_city as aw
FROM ".TABLE_GAMES.", ".TABLE_TEAMS." as h, ".TABLE_TEAMS." as a
WHERE ga_home_id=h.te_id AND ga_away_id=a.te_id AND
ga_date >= $from AND ga_date < $to
ORDER BY ga_date ASC";
$results = $this->db->getAll($sql);
return $results;
}
public function getDays() {
$sql = "SELECT count(*) as count, DATE_FORMAT(FROM_UNIXTIME(ga_date), '%Y-%m-%d') AS date, ga_date
FROM ".TABLE_GAMES."
GROUP BY date
ORDER BY ga_date ASC";
$days = $this->db->getAll($sql);
return $days;
}
public function gamesCount() {
$sql = "SELECT count(*) as count
FROM ".TABLE_GAMES;
$count = $this->db->getOne($sql);
return $count;
}
}
?>
Kai eini į failą results.php?date=237760116 rodo rezultatus kur data 237760116, o man reikia, kad einant adresu date=2009-03-24 rodytų visus įrašus kur kada yra 2009-03-24... Ten tas kodas kur daviau yra funkcijų failas. Jį reikia kažkaip suredaguot.
Redagavo Narysx· 2009 Kov. 24 18:03:04
Parašė Narysx· 2009 Kov. 24 20:03:02
#5
Up... Paskutinį kartą, gal atsiras žinančių...