yeahz Posted February 14, 2009 Report Share Posted February 14, 2009 (edited) Kas te ir nepareizi? Pat ja man nauda ir mazāk nekā ir cena, visu laiku rāda 'Var nopirkt'. function vaiVarNopirkt($cena) { $id = $_SESSION['user_id']; $sql = mysql_query("SELECT gold FROM users WHERE id = $id"); $nauda_lietotajam = mysql_fetch_row($sql); if ($cena < $nauda_lietotajam) echo "<div class='pirkt_kugi_iegadaties_var'>Var nopirkt</div>"; elseif ($cena >= $nauda_lietotajam) echo "<div class='pirkt_kugi_iegadaties_nevar'>Nevar nopirkt</div>"; } Edited February 14, 2009 by yeahz Quote Link to comment Share on other sites More sharing options...
bubu Posted February 14, 2009 Report Share Posted February 14, 2009 Tas vai tad nav normāli? Ja tev ir vairāk naudas, nekā preces cena, tad to var nopirkt. Quote Link to comment Share on other sites More sharing options...
yeahz Posted February 14, 2009 Author Report Share Posted February 14, 2009 Uj, nepareizi pateicu, biju domājis pat ja nauda ir mazāk nekā cena. :D Quote Link to comment Share on other sites More sharing options...
rausis Posted February 14, 2009 Report Share Posted February 14, 2009 (edited) vaitad $nauda_lietotajam nesanāk masīvs ar indeksu un vērtību? nevajag kkā tā: $nauda_lietotajam['gold'] ? :) Edited February 14, 2009 by rausis Quote Link to comment Share on other sites More sharing options...
bubu Posted February 14, 2009 Report Share Posted February 14, 2009 Un kāpēc, ja $cena == $nauda_lietotajam, tad "Nevar nopirkt" ? 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.