false Posted November 23, 2009 Report Share Posted November 23, 2009 Kods: <?php if(isset($_GET['op']) && $_GET['op'] == 'atdot'){ echo "Kam tu gribi atdot naudu?<br/><input name='lietotaajs' type='text'><br/>Cik tu gribi atdot?<br/><input name='cik' type='text'><input name='submjit' type='submit' value='Aizdot!'><br/>"; } if(isset($_POST['submjit'])){ $l_co = $jor['coins']; $l_coins = $_POST['cik']; if($l_coins > $l_co){ echo "Aizsūtīts!"; $dadads = mysql_query("SELECT * FROM lietotaaji WHERE niks=".$_POST['lietotaajs'].""); while(mysql_fetch_array($dadads)){ $liet_coins = $kasd['coins']; $sn_id = $kasd['id']; $user_c_a = $l_co-$l_coins; $da_c = $liet_coins+$l_coins; mysql_query("UPDATE lietotaaji SET coins=".$da_c." WHERE id=".$sn_id.""); mysql_query("UPDATE lietotaaji SET coins=".$user_c_a." WHERE id=$id"); } }else{ echo "<div class=error>Tev nepietiek naudas!</div>"; } } } ?> Bet nekas neupdeitojas datubāzē.. Kāds var pateikt, kas par kļūdu? Quote Link to comment Share on other sites More sharing options...
rATRIJS Posted November 23, 2009 Report Share Posted November 23, 2009 Tu vispār kādreiz ņem vērā kaut kādus ieteikumus? Quote Link to comment Share on other sites More sharing options...
briedis Posted November 23, 2009 Report Share Posted November 23, 2009 Ieteiktu sākt dot mainīgajiem loģiskus nosaukumus, citādi pats var saprutroties... $dadads, $l_coins, $l_co, $da_c, $kasd... Quote Link to comment Share on other sites More sharing options...
thesnarkie Posted November 23, 2009 Report Share Posted November 23, 2009 (edited) if(isset($_GET['op']) && $_GET['op'] == 'atdot'){ 1. kas pie ir tas tāds? vienkārši: if($_GET['op'] == "atdot") { //bla bla } $l_co = $jor['coins']; 2. no kurienes šitais uzrodas ? $dadads = mysql_query("SELECT * FROM lietotaaji WHERE niks=".$_POST['lietotaajs'].""); 3. nebāz neko datubāzē, pirms neesi eskeipojis stringus. tas pats attiecās uz tiem update kverijiem. šādi: $niks = mysql_real_escape_string($_POST['lietotaajs']); $dadads = mysql_query("SELECT * FROM `lietotaaji` WHERE `niks`='$niks'"); ok, tālāk ir vēl lielāka putra. sāc domāt loģiski. sastādi darbību secību. un es neredzu, ka skripts meklētu savienojumu ar datubāzi.. Edited November 23, 2009 by thesnarkie 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.