Jump to content

[SOLVED] Why does it change the name to 0? Please help.


Shiny_Charizard

Recommended Posts

<?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?

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]'");

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.