Thursday 15 May 2014

php - Multiple ids with one form -


I really do not know what I want, but I will try, I know that my code is awful and one It's a big mess, I'm really very bad / any help would be appreciated.

I am building a shop for my game, and there is a database in which the price / type / id of pocon in Pokan Shop. Right now I'm working around it, it displays all the pokémon in the store and they all have a shopping button, but for some reason whatever you try to buy it only at the top of the list I buy only I hope I have explained that here is my code.

  if ($ _POST ['A'] == '1') {$ token = mysql_real_escape_string ($ _ POST ['token']); $ Token = bar_tag ($ token); $ Sql234 = "Select-ticket ticket"; $ Result2 = mysql_query ("select * ticket" ticket); While ($ row2 = mysql_fetch_array ($ result2)) {$ sql23 = "Select * User WHERE user name = '". $ _ Session ['username']. "')"; $ Result = mysql_query ("Choose user WHERE user name = '". $ _ Session [' username ']. "'" "); While ($ line = mysql_fetch_array ($ result)) {resonant "you have". $ Line ['ticket']. "Ticket"; Echo "& lt; p & gt; & lt; / p & gt; ; If (isset ($ _ POST ['slot1'])) {if ($ row ['ticket']> gt; = $ row2 ['price']) {resonant "you have bought" $ Row2 ['Pokemon'] ""; MySQL_query ("UPDATE user set ticket = ticket -". $ Line 2 ['value']. ​​"WHERE user name = '". $ _ Session [' username ']. "'") Or die (mysql_error ()) ; Type VALUES ('. $$ 2 [' pokemon ']'. '', '". $ _ Session [' user name] 'in Mysql_query (" user_pokemon (pokemen, related, XP, time_stamp, slot, level, type) '', '100', '', time (). '', '0', '5', ''. $ Line2 ['type']. '') ") Or die (mysql_error ()) ;} Else {echo "you can not afford". $ Line 2 ['Pokemon']. ""}}}}}}? & Gt; & lt ;? php $ result = mysql_query (select "ticket" Ticket "); while ($ line = mysql_fetch_array ($ result)) {$ sql2 =" SELECT * FROM pokemon WHERE name = '". $ Line [' pokemon ']."'; $ Result2 = mysql_query ($ sql2) Or die (mysql_error ()); $ Ba Ttle_get2 = mysql_fetch_array ($ result2); echo '' img src = "pokemon / ' $ Line ['type']. '' $ Battle_get2 ['pic']. '' Limit = 0> & Lt; / A & gt; '; $ Idd = mysql_real_escape_string ($ line2 ['id']); $ Iddd = strip_tags ($ idd); ? & Gt; & Lt; / Span & gt; & Lt; Form name = "slot 1" action = "" method = "post" & gt; & Lt; Div align = "center" & gt; & Lt; P & gt; & Lt; Period & gt; & Lt; Select name = "A" id = "" & gt; & Lt; Option value = "1" & gt; Buy & lt; / Options & gt; & Lt; / Select & gt; & Lt; Input type = "hidden" name = "token" id = "token" value = "& lt ;? php echo $ iddd ;? & gt;" / & Gt; & Lt; Br / & gt; & Lt; Input type = "submit" class = "submit" value = "accept" name = "slot 1" & gt; & Lt; / Span & gt; & Lt; / P & gt; & Lt; / Div & gt; & Lt; / Form & gt; & Lt; Period & gt; & Lt ;? Php echo $ row ['pokemon']; ? & Gt; & Lt; / Span & gt; & Lt; P & gt; & Lt; / P & gt; & Lt; Period & gt; & Lt ;? Php echo "Type:"; Echo ['type'] per line; ? & Gt; & Lt; / Span & gt; & Lt; P & gt; & Lt; / P & gt; & Lt; Period & gt; & Lt ;? Php echo "value:"; Echo ['value'] per line; Echo "
"; }? & Gt;

  Below are you doing wrong: $ sql234 = "SELECT * FROM Ticketshop "; $ Result2 = mysql_query ("select * ticket" ticket); Here you are not adding any condition to fetch a particular record, please see the improvement below: $ sql234 = "select * ticket ticket '& lt; field name & gt; & gt; ='". $ Token $ Result2 = mysql_query ($ sql234);    

No comments:

Post a Comment