GeRik Posted June 29, 2009 Report Share Posted June 29, 2009 (edited) Ja man ir pienemsim shads te $selekts=mysql_query("SELECT * FROM ibf_sessions WHERE member_id=".$_COOKIE['member_id']); while($r=mysql_fetch_array($selekts)) { if(isset($_POST['ierakstiit'])) { $ieraksts=$_POST['ieraksts']; $laiks=time(); $membera_niks=$r['member_name']; mysql_query("INSERT INTO chats (ieraksts, laiks, niks) VALUES ('$ieraksts','$laiks','$membera_niks')"); } un shis te kas paradas lapa <form action="" method="post"> <input type="text" name="ieraksts" /> <input type="submit" name="ierakstiit" value="ok" /> ka uzlikt lai arii laiku ieraksta laiku datubaze ? Edited June 29, 2009 by GeRik Quote Link to comment Share on other sites More sharing options...
J0ke Posted June 29, 2009 Report Share Posted June 29, 2009 (edited) ehem datubāzei tabula kāda izskatās, tobiš tips kāds laikam uzlikts? ja time() funkcijas vietā var izmantot $_SERVER[‘REQUEST_TIME’] ;) nav labi ciklā vienu un to pašu funkciju izsaukt ntās reizes... Edited June 29, 2009 by J0ke Quote Link to comment Share on other sites More sharing options...
GeRik Posted June 29, 2009 Author Report Share Posted June 29, 2009 date ir tips! nesapratu vienalga ka ielikt Quote Link to comment Share on other sites More sharing options...
mickys Posted June 29, 2009 Report Share Posted June 29, 2009 (edited) lie tipu kā int(11) un laiku ņem no time() f-jas lai to izvadītu selektēsi to lauku un varēsi formatēt to laiku kā vēlies ar date() f-ju par f-jām, lauku pievienošanu, var izlasīt netā.. edit: faktiski jau tev tur viss ir pareizi, tikai datu tipam jābūt integer ar garumu 11 ja nemaldos, jo time() f-ja atgriež timestamp Edited June 29, 2009 by mickys Quote Link to comment Share on other sites More sharing options...
GeRik Posted June 29, 2009 Author Report Share Posted June 29, 2009 (edited) nesapratu? man kuras rindinjas ir jalabo ? un uz laiks tabula jaliek uz int(11) Edited June 29, 2009 by GeRik Quote Link to comment Share on other sites More sharing options...
mickys Posted June 29, 2009 Report Share Posted June 29, 2009 principā jau tikai tas arī jāmaina Quote Link to comment Share on other sites More sharing options...
GeRik Posted June 29, 2009 Author Report Share Posted June 29, 2009 nu es to nomainiju un man tagad pie laika datubaze ieraksta shadu te 1246257173 Quote Link to comment Share on other sites More sharing options...
marcis Posted June 29, 2009 Report Share Posted June 29, 2009 Tas arī ir UNIX Timestamp. Lai nu kā, es iebildīšu pret visiem un ieteikšu lietot DATETIME savienojumā ar NOW() funkciju. Quote Link to comment Share on other sites More sharing options...
Klez Posted June 29, 2009 Report Share Posted June 29, 2009 par datumiem un laikiem ir jāskatās kam to paredzēts izmantot ... tad attiecīgi jāizlemj vai turēt timestamp, datetime vai katraa laukaa savu: gadu, datumu un menesi ... Quote Link to comment Share on other sites More sharing options...
GeRik Posted June 29, 2009 Author Report Share Posted June 29, 2009 Nu mana gadijuma Mini chatam ShoutBox sakara ar to datetime vari pareizi uzrakstiit vietu kur vaidzetu but shi te vieta $laiks=time(); vienkarshi mocos un nesanak Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.