zintis8789 Posted February 7, 2010 Report Share Posted February 7, 2010 Man ir sads kods: <script type="text/javascript" src="ckeditor.js"></script> <?php include("config.php"); $u = $_GET['id']; $result12 = mysql_query("SELECT * FROM `jaunumi` WHERE id='$u'"); $row1 = mysql_fetch_assoc($result12)or die(mysql_error()); $nosaukums = $row1[nos]; $ie = $row1[ievads]; $tests = $row1[zina]; $nos = $_POST['nos']; $zina = $_POST['zina']; $ievads = $_POST['ievads']; mysql_query("SET NAMES UTF8 COLLATE utf8_general_ci"); if(isset($_POST['submit'])){ if(!$nos || !$zina || !$ievads){ echo "<font color=red>Aizpildi visus laukumus</font>"; echo "<meta http-equiv='refresh' content='0; url=index.php'>"; }else{ $u = $_GET['id']; mysql_query("UPDATE jaunumi SET nos='$nos', zina='$zina', ievads='$ievads' WHERE id='$u' "); echo "<font color=green>Esi veiksmigi editojis jaunumus</font> "; } } ?> <center> <form method="post" action="" > Nosaukums: <input type=text name=nos value="<? echo $nosaukums; ?>" > <p>Ievads: <textarea name=ievads > <? echo $ie; ?> </textarea> <p>Teksts: <textarea name=zina > <? echo $tests; ?> </textarea> <p> <input type=submit name=submit value=EDITOT> </p> </form> <script type="text/javascript"> CKEDITOR.replace( 'zina' ); CKEDITOR.replace( 'ievads' ); </script> Es izvelu tekstu no db editoju spiezu lai saglaba bet nesaglabajas izmainas. Quote Link to comment Share on other sites More sharing options...
briedis Posted February 7, 2010 Report Share Posted February 7, 2010 tavs kods ir vienkārši nelasāms. Sāc arī ar to, ka saliec pēdiņas atribūtu vērtībām (ja zini, kas tas ir). Lieto kkādas normālas atkāpes, jaunas rindiņas, tabulāciju... Quote Link to comment Share on other sites More sharing options...
zintis8789 Posted February 7, 2010 Author Report Share Posted February 7, 2010 Uzrakstiju OR die(mysql_error()); Paradijas: Got a packet bigger than 'max_allowed_packet' bytes Quote Link to comment Share on other sites More sharing options...
briedis Posted February 7, 2010 Report Share Posted February 7, 2010 <script type="text/javascript" src="ckeditor.js"></script> <?php include("config.php"); $u = $_GET['id']; $result12 = mysql_query("SELECT * FROM `jaunumi` WHERE id='$u'"); $row1 = mysql_fetch_assoc($result12)or die(mysql_error()); $nosaukums = $row1[nos]; $ie = $row1[ievads]; $tests = $row1[zina]; $nos = $_POST['nos']; $zina = $_POST['zina']; $ievads = $_POST['ievads']; mysql_query("SET NAMES UTF8 COLLATE utf8_general_ci"); if(isset($_POST['submit'])){ if(!$nos || !$zina || !$ievads){ echo "<font color=red>Aizpildi visus laukumus</font>"; echo "<meta http-equiv='refresh' content='0; url=index.php'>"; }else{ $u = $_GET['id']; mysql_query("UPDATE jaunumi SET nos='$nos', zina='$zina', ievads='$ievads' WHERE id='$u' "); echo "<font color=green>Esi veiksmigi editojis jaunumus</font> "; } } ?> <center> <form method="post" action=""> Nosaukums: <input type=text name=nos value="<? echo $nosaukums; ?>" > <p> Ievads: <textarea name=ievads > <? echo $ie; ?> </textarea> <p>Teksts: <textarea name=zina > <? echo $tests; ?> </textarea> <p> <input type=submit name=submit value=EDITOT> </p> </form> <script type="text/javascript"> CKEDITOR.replace( 'zina' ); CKEDITOR.replace( 'ievads' ); </script> Bet te tik un tā ir 101 kļūda. Kaut kādi tagi sākās, bet nekur nebeidzās... Nav norādīts formai action atribūta vērtība... Quote Link to comment Share on other sites More sharing options...
2easy Posted February 7, 2010 Report Share Posted February 7, 2010 Nav norādīts formai action atribūta vērtība... ta nu gan "kļūda" by default forma tiek submitota uz pašreizējo adresi Quote Link to comment Share on other sites More sharing options...
eude Posted February 7, 2010 Report Share Posted February 7, 2010 es nekur neredzu, ka tev būtu norādīts id, kurš ir jāupdeito. Quote Link to comment Share on other sites More sharing options...
zintis8789 Posted February 7, 2010 Author Report Share Posted February 7, 2010 es nekur neredzu, ka tev būtu norādīts id, kurš ir jāupdeito. $u = $_GET['id']; mysql_query("UPDATE jaunumi SET nos='$nos', zina='$zina', ievads='$ievads' WHERE id='$u' "); Quote Link to comment Share on other sites More sharing options...
briedis Posted February 7, 2010 Report Share Posted February 7, 2010 $u = $_GET['id']; mysql_query("UPDATE jaunumi SET nos='$nos', zina='$zina', ievads='$ievads' WHERE id='$u' "); uzraksti kodam augšā: echo "<pre>"; print_r($_POST); echo "</pre>"; un apskaties, kādas vērtības tiek padotas no formas... Quote Link to comment Share on other sites More sharing options...
2easy Posted February 7, 2010 Report Share Posted February 7, 2010 (edited) $u = $_GET['id']; mysql_query("UPDATE jaunumi SET nos='$nos', zina='$zina', ievads='$ievads' WHERE id='$u' "); eude runāja par id, ka tam ir jābūt vai nu html formā vai adresē debugojot skaties gan get, gan post vērtības echo '<pre>' . print_r($_GET, 1) . print_r($_POST, 1) . '</pre>'; Edited February 7, 2010 by 2easy Quote Link to comment Share on other sites More sharing options...
eude Posted February 8, 2010 Report Share Posted February 8, 2010 atvainojos, ka biju neskaidri uzrakstījis. id trūkst formā, jo tur nav neviena lauka ar id vērtību ko padod, lai var ierakstīt datubāzē. un tā kā tev nav uzrakstīts formai action galamērķis, tad to nevar arī iegūt no adreses jeb no šī $u = $_GET['id']; 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.