jauninjais Posted March 16, 2006 Report Share Posted March 16, 2006 vai kaads man nevareetu pateikt, varbuut pashiem taa gadiijies vai varbuut juus zinaat, nu man probleema taada, ka es itkaa ieraxtu ar insert into no formas panjemto informaaciju, bet man datu baazee paraadaas ne tikai taa mani ieraxtiitaa zinja bet vinsh izveido veel vienu zinju, kura ir pilniigi tuksha. kaa deelj tas vareetu buut? Link to comment Share on other sites More sharing options...
Blitz Posted March 16, 2006 Report Share Posted March 16, 2006 kodu paradi... Link to comment Share on other sites More sharing options...
Delfins Posted March 16, 2006 Report Share Posted March 16, 2006 1.) 2-inserti (lame-kods) 2.) trigeri (diez vai tavs gadijums :)) Link to comment Share on other sites More sharing options...
jauninjais Posted March 16, 2006 Author Report Share Posted March 16, 2006 nu kods ir lame, drusku, jo posta nodoshana ir vienaa un tajaa pashaa lapaa :) <html> <head> </head> <body> <form method="post" action="jauna_zinja.php"> <table> <tr> <td><textarea name="zinja" wrap="virtual" rows="10" cols="40" style="color: #800000">jauna ziņa</textarea></td></tr><tr align="center"><td> <input type="submit" name="submit" value="Ierakstīt"> </font> </form> </td> </tr></table> <? $zinja=$_POST['zinja']; $konekcija=mysql_connect('127.0.0.1','123','345') or die ("Datu bāzei pieslēgties neizdevās"); mysql_select_db('db',$konekcija); $vaicajums=mysql_query("INSERT INTO `info`(`zinja`) VALUES ('$zinja')",$konekcija); mysql_close($konekcija); ?> </body> </html> Link to comment Share on other sites More sharing options...
Blitz Posted March 16, 2006 Report Share Posted March 16, 2006 (edited) tad kad tu palaid skriptu tad post ir tuks un vins pievieno to tukso datubazei... tad kad tu ieraksti datus un noposto tad vins ieraksta isto zinu... takaa pirms mysql_query pielic parbaudi if ($_POST['zina']!=="") { $vaicajums=mysql_query("INSERT INTO `info`(`zinja`) VALUES ('$zinja')",$konekcija); } un lai 2x nekonektetos pie db tad barbaudi labak liec pirms konektesanas un tad visu parejo sql penteri Edited March 16, 2006 by Blitz Link to comment Share on other sites More sharing options...
Delfins Posted March 16, 2006 Report Share Posted March 16, 2006 mueh.. INSERT izpildās pie katras lapas ielādes (kamēr vadi formu iekšā - jau kaut kas ir ierkastīts [tukšums] ) Link to comment Share on other sites More sharing options...
jauninjais Posted March 16, 2006 Author Report Share Posted March 16, 2006 pag a shitaaa nevar likt? <? $zinja=$_POST['zinja']; $konekcija=mysql_connect('127.0.0.1','123','345') or die ("Datu bāzei pieslēgties neizdevās"); mysql_select_db('db',$konekcija); if ($_POST['zina']!=="") { $vaicajums=mysql_query("INSERT INTO `info`(`zinja`) VALUES ('$zinja')",$konekcija); } mysql_close($konekcija); ?> Link to comment Share on other sites More sharing options...
Blitz Posted March 16, 2006 Report Share Posted March 16, 2006 (edited) Es jau teicu ka tad tev iznak konekteties pie DB divas reizes, un kada jega to darit ja var izstikt ar 1x... <? $zinja=$_POST['zinja']; if ($zinja!=="") { $konekcija=mysql_connect('127.0.0.1','123','345') or die ("Datu bāzei pieslēgties neizdevās"); mysql_select_db('db',$konekcija); $vaicajums=mysql_query("INSERT INTO `info`(`zinja`) VALUES ('$zinja')",$konekcija); mysql_close($konekcija); } ?> Edited March 16, 2006 by Blitz Link to comment Share on other sites More sharing options...
jauninjais Posted March 16, 2006 Author Report Share Posted March 16, 2006 tomeer vinsh taapat pieliek to tuksho vietu. Link to comment Share on other sites More sharing options...
Blitz Posted March 16, 2006 Report Share Posted March 16, 2006 tak uzstaisi sakarigu parbaudi, es tik tev piemeru pateicu Link to comment Share on other sites More sharing options...
jauninjais Posted March 16, 2006 Author Report Share Posted March 16, 2006 a kas shai vainas, vinsh taapat paarbauda, un ja zinja nav tukshums, tad ieliek. kaapeec tad vinsh tomeer neizpilda sho paarbaudi? Link to comment Share on other sites More sharing options...
Blitz Posted March 16, 2006 Report Share Posted March 16, 2006 nu varbut tev nopostojas "" vai " " vai " ", es tak nez... liec parbaudi piemeram $zinja=trim($zinja); $l=str_lenght($zinja); if ($l>0) { ..... taksh varianti ir daudz, pameklee sev vis labako.... Link to comment Share on other sites More sharing options...
Delfins Posted March 16, 2006 Report Share Posted March 16, 2006 blin, function isPOST() { return ($_SERVER['REQUEST_METHOD']=='POST'); } if (isPOST()) { if ( checkVal(...) ) { $sql = "INSERT..."; } } Link to comment Share on other sites More sharing options...
jauninjais Posted March 16, 2006 Author Report Share Posted March 16, 2006 a ko noziimeeja Call to undefined function ... ? Link to comment Share on other sites More sharing options...
bubu Posted March 16, 2006 Report Share Posted March 16, 2006 To, ka funkcija nav definēta. To var viegli ar vārdnīcu iztulkot, btw. Link to comment Share on other sites More sharing options...
Recommended Posts