Jump to content
php.lv forumi

Fail jautājums


vitao.web

Recommended Posts

$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

$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 by Mr.Key
Link to comment
Share on other sites

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

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 by vitao.web
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...