Shiny_Charizard Posted January 25, 2008 Share Posted January 25, 2008 <?PHP include('connect.php'); session_start(); //variables $submit = $_POST["submit"]; $slot1_2= mysql_query("SELECT * FROM pokemon WHERE username='$username' AND slot='1'"); $slot1= mysql_fetch_array($slot1_2); if(isset($submit)) { //If evolving Chimchar if($slot1[pkmn_name] == "Chimchar" && $slot1[pkmn_level] == "36") { mysql_query("UPDATE pokemon SET pkmn_name='Monferno' AND pkmn_sprite='http://tpfrpg.ghostblade.us/images/pokemon/Monferno.png' AND pkmn_icon='http://tpfrpg.ghostblade.us/images/pokemon/icons/monferno.png' WHERE pokemon_id='$slot1[pokemon_id]'"); echo "<center>Congratulations! Your <b>Chimchar</b> evolved into a <b>Monferno</b>!</center>"; } //If evolving Monferno elseif($slot1[pkmn_name] == "Monferno" && $slot1[pkmn_level] == "56") { mysql_query("UPDATE pokemon SET pkmn_name='Infernape' AND pkmn_sprite='http://tpfrpg.ghostblade.us/images/pokemon/Infernape.png' AND pkmn_icon='http://tpfrpg.ghostblade.us/images/pokemon/icons/infernape.png' WHERE pokemon_id='$slot1[pokemon_id]'"); echo "<center>Congratulations! Your <b>Monferno</b> evolved into an <b>Infernape</b>!</center>"; } //If evolving Charmander elseif($slot1[pkmn_name] == "Charmander" && $slot1[pkmn_level] == "36") { mysql_query("UPDATE pokemon SET pkmn_name='Charmeleon' AND pkmn_sprite='http://tpfrpg.ghostblade.us/images/pokemon/Charmeleon.png' AND pkmn_icon='http://tpfrpg.ghostblade.us/images/pokemon/icons/charmeleon.png' WHERE pokemon_id='$slot1[pokemon_id]'"); echo "<center>Congratulations! Your <b>Charmander</b> evolved into a <b>Charmeleon</b>!</center>"; } //If evolving Charmeleon elseif($slot1[pkmn_name] == "Charmeleon" && $slot1[pkmn_level] == "56") { mysql_query("UPDATE pokemon SET pkmn_name='Charizard' AND pkmn_sprite='http://tpfrpg.ghostblade.us/images/pokemon/Charizard.png' AND pkmn_icon='http://tpfrpg.ghostblade.us/images/pokemon/icons/charizard.png' WHERE pokemon_id='$slot1[pokemon_id]'"); echo "<center>Congratulations! Your <b>Charmeleon</b> evolved into a <b>Charizard</b>!</center>"; } else { echo "<center>Your $slot1[pkmn_name] can't evolve.</center>"; } } echo"<br /> <br /> <br /> <form action='evolve.php' method='POST'> <center> Do you want to evolve your $slot1[pkmn_name]? <br /> <IMG SRC='$slot1[pkmn_sprite]'> <br /> <input type='submit' name='submit' value='Evolve'> </center> </form>"; ?> Why does it change the "pkmn_name" MySQL row to 0 instead of the name specified in the code and it doesn't even update the MySQL rows "pkmn_sprite" & "pkmn_icon". Why? Quote Link to comment https://forums.phpfreaks.com/topic/87696-solved-why-does-it-change-the-name-to-0-please-help/ Share on other sites More sharing options...
revraz Posted January 25, 2008 Share Posted January 25, 2008 Use commas not AND mysql_query("UPDATE pokemon SET pkmn_name='Monferno', pkmn_sprite='http://tpfrpg.ghostblade.us/images/pokemon/Monferno.png', pkmn_icon='http://tpfrpg.ghostblade.us/images/pokemon/icons/monferno.png' WHERE pokemon_id='$slot1[pokemon_id]'"); Quote Link to comment https://forums.phpfreaks.com/topic/87696-solved-why-does-it-change-the-name-to-0-please-help/#findComment-448559 Share on other sites More sharing options...
Shiny_Charizard Posted January 25, 2008 Author Share Posted January 25, 2008 Thanks a lot it works now. Quote Link to comment https://forums.phpfreaks.com/topic/87696-solved-why-does-it-change-the-name-to-0-please-help/#findComment-448579 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.