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? 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]'"); 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. 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
Archived
This topic is now archived and is closed to further replies.