Uldeens Posted November 18, 2003 Report Share Posted November 18, 2003 (edited) Ir forma: <form action="send.php" method="post"> <input type="text" name="email"> <br> <input type="text" name="name"> <br> <input type="text" name"text"> <br> <input type="submit" value="go"> </form> Un <?> kas negrib rakstiit.. <? //Nodefineeju servera un datubaazes parametrus $hostname = "localhost" ; //Servera adrese $dbuser = "root" ; //Defaultaa username root $dbpass = "" ; // Defaulta password tuksums $dbname = "forums" ; //Datubazes nosaukums $usertable = "forum"; //Tabulas nosaukums $date=date("d.m.y, h:ia"); //pievienojos serverim un izveelos datubaazi mysql_connect($hostname,$dbuser,$dbpass) ; // Konekteejos serverim mysql_select_db("$dbname"); //Izvelos DB mysql_query("INSERT INTO $usertable (email,name,date,text) VALUES ( '$email','$name','$date', '$text')"); ?> Galvenais mani interesee tas $DATE vai ir pareiza doma taadaa veidaa pievienot datumu DB ierakstiem. Edited November 18, 2003 by Uldeens Link to comment Share on other sites More sharing options...
Little_Hacker Posted November 18, 2003 Report Share Posted November 18, 2003 IMHO nav pareizaakas vairaints. Labaak ir glabaat kaa vienkaarshu unix laiku.. tb time() .. un viss, bet pie nolasiishanas to laiku paarveidot par sev vajadziigo formaatu. Link to comment Share on other sites More sharing options...
Aleksejs Posted November 19, 2003 Report Share Posted November 19, 2003 Negribu buut piekasiigs, bet string mainiigos NAV jaaliek peedinjaas. shitaa vietaa: ... mysql_select_db("$dbname"); //Izvelos DB ... buutu jaaraksta: ... mysql_select_db($dbname); //Izvelos DB ... Link to comment Share on other sites More sharing options...
Roze Posted November 21, 2003 Report Share Posted November 21, 2003 Lai paarbaudiitu kapeec kaut kas nenotiek aiz mysql_querijiem test anoluukoas der vienmeer ielikt echo mysql_errno() . ": " . mysql_error() . "\n"; http://lv.php.net/mysql_error Un tad uzreiz buus skaidrs kas par klapataam :) Kas attiecas uz datumu tad variants ir galabaat timestampaa vai uzskataamaak (cilveeciskaak saprotami) ielikt mysql lauku DATETIME un tad $datums = date("Y-m-d H:i:s"); parastu varchar lauku labaak ne.. Jo tad zuud visa jeega un nav iespeejamas operacijas ar datumiem no mysql puses.. Negribu buut piekasiigas bet shajaa gadijumaa IR VIENALGA vai ir mysql_select_db("$dbname"); vai mysql_select_db($dbname); String mainiigos liek peedinjaas kad ir vajadziiba paarseet kopeejo parametru/stringu.. piem ("some_$dbname"); Link to comment Share on other sites More sharing options...
Recommended Posts