vitao.web Posted December 7, 2010 Author Report Share Posted December 7, 2010 Izmantojot Ratrija variantu viss stradā, bet tik tie laiki nepareizi norādās, bet tavā varianta serveris vnk nokarās. Link to comment Share on other sites More sharing options...
rATRIJS Posted December 7, 2010 Report Share Posted December 7, 2010 Jup taa ir (iemaaciijos ko jaunu shodien ^_^) -> http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_unix-timestamp Mr.Key variants ir vislabaakais IMO. Link to comment Share on other sites More sharing options...
Mr.Key Posted December 7, 2010 Report Share Posted December 7, 2010 Izmantojot Ratrija variantu viss stradā, bet tik tie laiki nepareizi norādās, bet tavā varianta serveris vnk nokarās. jūtu līdzi! Link to comment Share on other sites More sharing options...
vitao.web Posted December 7, 2010 Author Report Share Posted December 7, 2010 $izs = dbFetch("SELECT id, title, cat,message,DATE_FORMAT(date, '%b %d %Y %h:%i %p') AS newdate, UNIX_TIMESTAMP(date) AS laiks FROM blog ORDER BY id DESC LIMIT 8;"); while($rez = mysql_fetch_assoc($izs)){ $time = $rez['laiks']; $time = strtotime($time); $age = getAge($time); Es te kaut ko nepareizi daru vai kā? Jo man izmantojot šo AppServ vienkārši pakarās :( Link to comment Share on other sites More sharing options...
Mr.Key Posted December 7, 2010 Report Share Posted December 7, 2010 (edited) $izs = dbFetch("SELECT id, title, cat,message,DATE_FORMAT(date, '%b %d %Y %h:%i %p') AS newdate, UNIX_TIMESTAMP(date) AS laiks FROM blog ORDER BY id DESC LIMIT 8;"); while($rez = mysql_fetch_assoc($izs)){ $time = $rez['laiks']; $age = getAge($time); $time = strtotime($time); tev nevis serveris pakaras, bet nav ieslēgtes error reporting uz dev vides, tobish, tev nekas nepakaras, vnk. izlec balta lapa, jo ir errors. skaties error logu vai arī ieslēdz error reporting Edited December 7, 2010 by Mr.Key Link to comment Share on other sites More sharing options...
briedis Posted December 7, 2010 Report Share Posted December 7, 2010 neredzu while aizverošās figūriekavas... Link to comment Share on other sites More sharing options...
rATRIJS Posted December 7, 2010 Report Share Posted December 7, 2010 strtotime nevajag izmantot, jo UNIX_TIMESTAMP jau izdara visu ko vajag. Link to comment Share on other sites More sharing options...
vitao.web Posted December 7, 2010 Author Report Share Posted December 7, 2010 Nu tad tā! Ir viss kā nākas, kad izņemu sorttime, bet problēma, ka nepareizi laiki :( id title cat message newdate laiks 14 beidzot viss strada <p>tes est tres</p> Dec 07 2010 12:00 AM 1291672800 Izraksts no DB, ierakstot tikai šo query, bet problēma, ka parāda nepareizu laiku, vai ari ievada nepareizu. web lapa izvada: 15 hours ago Link to comment Share on other sites More sharing options...
Mr.Key Posted December 7, 2010 Report Share Posted December 7, 2010 ievada (tu saglabaa tikai datumu, bez time dalas) ko atgriez SQL "DESCRIBE blog"? Link to comment Share on other sites More sharing options...
vitao.web Posted December 7, 2010 Author Report Share Posted December 7, 2010 (edited) ievada (tu saglabaa tikai datumu, bez time dalas) ko atgriez SQL "DESCRIBE blog"? Pilni teksti Field Type Null Key Default Extra Labot Dzēst id int(30) NO PRI NULL auto_increment Labot Dzēst title varchar(150) NO NULL Labot Dzēst message text NO NULL Labot Dzēst cat varchar(40) NO NULL Labot Dzēst date date NO NULL Labot Dzēst ip varchar(40) NO NULL Sapratu kļūdu vajadzēja datetime nevis date! Paldies visiem par pacietību un palīdzību! Edited December 7, 2010 by vitao.web Link to comment Share on other sites More sharing options...
Mr.Key Posted December 7, 2010 Report Share Posted December 7, 2010 (edited) lauka date tipu vajag datetime, nevis date. nomaini. Edited December 7, 2010 by Mr.Key Link to comment Share on other sites More sharing options...
vitao.web Posted December 7, 2010 Author Report Share Posted December 7, 2010 lauka date tipu vajag datetime, nevis date. nomaini. Jau atradu kļūdu :) Paldies vēlreiz par palīdzību! Link to comment Share on other sites More sharing options...
Recommended Posts