djmartins Posted April 11, 2006 Report Share Posted April 11, 2006 Taa tad tads jautajums.Kaa varetu uztaisit ka lapai refresojoties ik pec 5 sekundem katru reizi kad notiek lapas parladesana summejas sis 5 sekundes un glabajas db. Apmeram ka es veletos! Lapa refresojas 2 reizes. Pirmo 5 aizsutam uz db vins tur sez. Otro 5 no otras parladesanas reizes sutam uz db ta lai tas sasumetos kopa un tur db tagad sedetu 10. Nu kaut ka ta es veletos tacu nezinu ka lai uztaisa!Butu jauki ja kadam butu kads piemers.Paldies jau ieprieks. Link to comment Share on other sites More sharing options...
ohmygod Posted April 11, 2006 Report Share Posted April 11, 2006 Tev vajag tieshi sekunzhu skaitu vai arī stundas un minūtes? Katram userim, sesijai vai nu kam tu to taisi - savs ieraksts tabulā? Ja vajag tikai sesijai, tad manuprāt labāk taisīt ar date laukiem un tabulā likt sākuma un beigu laiku. Beigu laiku visu laiku updeitojot ar "UPDATE datetable set end_time = now() WHERE id = '$id'" Insertojot pirmo reizi liec arī start_date kā now(); Ja gribi tieši sekundes skaitīt - tev pa priekšu janoselektē to, kas ir iekš db - PHP jāpieskaita 5 un UPDATE datetable SET sekundes = '$seks' WHERE id = '$id' Kaut kā tā... Link to comment Share on other sites More sharing options...
djmartins Posted April 11, 2006 Author Report Share Posted April 11, 2006 Hmm Kaa var pieskaitit to 5 un kaa izpauzas selectet to kas ieksa db? Link to comment Share on other sites More sharing options...
ohmygod Posted April 11, 2006 Report Share Posted April 11, 2006 "SELECT time FROM datetable WHERE id = '$id'" //dajebkāds WHERE - kas nu $row=mysql_fetch_array($query); tev tur ir. iekš PHP: $new_seks = $row['time']+5; Un tad UPDATE time uz $new_seks. Bet nu izskatās, ka no db tev nav ne mazākās nojēgas... :/ Ja jau prasi, kas ir selekts... Link to comment Share on other sites More sharing options...
v3rb0 Posted April 11, 2006 Report Share Posted April 11, 2006 nemāc' aplam, lai pieskaitīt' 5 nevajag php pusē skaitīt klāt. update tablename set fieldname=fieldname+5 where id ir kas nu tur Link to comment Share on other sites More sharing options...
djmartins Posted April 11, 2006 Author Report Share Posted April 11, 2006 Man sita galu gala sanaca bet kaut ka nestrada! Varetu paskatities kas pa vainu? <? include("config.php"); mysql_query("SELECT time FROM datetable WHERE id = '$id'"); $row=mysql_fetch_array($query); while ($res = mysql_fetch_array($result)) { echo("<td><input type=\"text\" name=\"time\" align=center value=\"$time\">5</td></tr>"); mysql_query("UPDATE online SET time=time+5 where id ='$id'"); } ?> Link to comment Share on other sites More sharing options...
Kavacky Posted April 11, 2006 Report Share Posted April 11, 2006 mysql_query("SELECT time FROM datetable WHERE id = '$id'");$row=mysql_fetch_array($query); Tas $query pats no sevis uzrodas, vai? Link to comment Share on other sites More sharing options...
Recommended Posts