help with attack page :(

Place for questions and answers for all newcomers and new coders. This is a free for all forum, no question is too stupid and to noob.
Post Reply
liel012
Posts: 4
Joined: Fri Jun 14, 2013 12:25 pm

help with attack page :(

Post by liel012 »

i have problem in my code..
the page is not work..

somone can tell me where the problem ?
the code -

Code: Select all

<?php
include "connect.php";


$playerinfo="SELECT * from players where name='player1'";
$playerinfo2=mysql_query($playerinfo);
$playerinfo3=mysql_fetch_array($playerinfo2);

if(isset($_GET['creature']))
{
$creature=$_GET['creature'];
$creatureinfo="SELECT * from creatures where name = '$creature'";
$creatureinfo2=mysql_query($creatureinfo);
$creatureinfo3=mysql_fetch_array($creatureinfo2);
}
else
{
echo "<a href='battle.php'>?? ???? ???? ?? ????? ??????. ???? ?????.";
}
$playerhp = $playerinfo3['hpoints'];
$playerattack =  $playerinfo3['attack'];
$playerdefence = $playerinfo3['defence'];

$creature = $creatureinfo3['name'];
$creaturehp = $creatureinfo3['hpoints'];
$creatureattack = $creatureinfo3['attack'];
$creaturedefence = $creatureinfo3['defence'];


echo "<u> " . $playerinfo3['name'] . " ??? ????? </u><br>";
$playerattack = rand(1,20) + $playerattack
$creaturedefence = rand(1,20) + $creaturedefence;

echo $playerinfo3['name'] . " ????? " . $playerattack . "<br>";
echo $creature . " ???? " . $creaturedefence. "<br>";

if ($playerattack>$creaturedefence)
{
echo $playerinfo3['name'] . "???? ! <br>";
$playerdamege= rand(1,6);
$newcreaturehp = $creaturehp - $playerdamege;
echo " ???? ???? ?? ". $playerdamage . "?????? ???? ??? ?????. <br>";
if ($newcreaturehp < 1)
{
echo "??????? ???? " . $creature . "???? ";
$updatecreature="DELETE from creatures where name='$creature' limit 1";
mysql_query($updatecreature);
echo "<a href='battle.php>???? ?????";
exit;
}
$updatecreature="update creatures set hpoints ='$newcreaturehp' where name='$creature'";
mysql_query ($updatecreature);
}
else
{
echo $playerinfo3['name'] . "????? ?? ???? ! <br>";
}
echo "<u> " . $crature . "????? </u><br>";
$creatureattack = rand(1,20) + $creatureattack;
$playerdefence = rand(1,20) + $playerdefence;
echo $creature . "????? " . $creatureattack. "<br>";
echo $playerinfo3['name'] . "???? " . $playerdefence . "<br>";

if ($creatureattack > $playerdefence)
{
echo $creature . " ???? ! <br>";
$creaturedamage= rand(1,6);
$newplayerhp = $playerhp - $creaturedamage;
echo "???? ???? ?? ". $creaturedamege . "?????? ???? ??? ????? . <br>";
if ($newplayerhp <1)
{
echo $playerinfo3['name'] . " ???? <br>";
echo "<a href='gameover.php> ????... ";
exit;
}
$updateplayer = "update plauer set hpoints = '$newplayerhp' where name='player1'";
mysql_query ($updateplayer);
}
else
{
echo $creature . "????? ?? ???? !";
}
echo "<br><br><a href='battle.php?creature=$creature>???? ??? !";
?>
Last edited by liel012 on Fri Jun 14, 2013 1:46 pm, edited 1 time in total.
User avatar
vitinho444
Posts: 2819
Joined: Mon Mar 21, 2011 4:54 pm

Re: help with attack page :(

Post by vitinho444 »

For what i read very lightly there seems to be no error.
Can you tell us what is happening? Like there's some kind of error in the page?
My Company Website: http://www.oryzhon.com

Skype: vpegas1234
liel012
Posts: 4
Joined: Fri Jun 14, 2013 12:25 pm

Re: help with attack page :(

Post by liel012 »

500 HTTP (Internal Server Error):
the page is not work..
User avatar
vitinho444
Posts: 2819
Joined: Mon Mar 21, 2011 4:54 pm

Re: help with attack page :(

Post by vitinho444 »

liel012 wrote:500 HTTP (Internal Server Error):
the page is not work..
That's very strange :O
Try checking the web console for errors maybe :S
My Company Website: http://www.oryzhon.com

Skype: vpegas1234
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: help with attack page :(

Post by hallsofvallhalla »

Well a 500 HTTP (Internal Server Error) is a server side error that could be anything. Be sure you are pointing to the right page.
liel012
Posts: 4
Joined: Fri Jun 14, 2013 12:25 pm

Re: help with attack page :(

Post by liel012 »

its happend to me when i have regular php errors...
just i have here problem and i cant see it !

Code: Select all

<?php
include "connect.php";


$playerinfo="SELECT * from players where name='player1'";
$playerinfo2=mysql_query($playerinfo);
$playerinfo3=mysql_fetch_array($playerinfo2);

if(isset($_GET['creature']))
{
$creature=$_GET['creature'];
$creatureinfo="SELECT * from creatures where name = '$creature'";
$creatureinfo2=mysql_query($creatureinfo);
$creatureinfo3=mysql_fetch_array($creatureinfo2);
}
else
{
echo "<a href='battle.php'>?? ???? ???? ?? ????? ??????. ???? ?????.";
}
$playerhp = $playerinfo3['hpoints'];
$playerattack =  $playerinfo3['attack'];
$playerdefence = $playerinfo3['defence'];

$creature = $creatureinfo3['name'];
$creaturehp = $creatureinfo3['hpoints'];
$creatureattack = $creatureinfo3['attack'];
$creaturedefence = $creatureinfo3['defence'];


echo "<u> " . $playerinfo3['name'] . " ??? ????? </u><br>";
$playerattack = rand(1,20) + $playerattack
$creaturedefence = rand(1,20) + $creaturedefence;

echo $playerinfo3['name'] . " ????? " . $playerattack . "<br>";
echo $creature . " ???? " . $creaturedefence. "<br>";

if ($playerattack>$creaturedefence)
{
echo $playerinfo3['name'] . "???? ! <br>";
$playerdamege= rand(1,6);
$newcreaturehp = $creaturehp - $playerdamege;
echo " ???? ???? ?? ". $playerdamage . "?????? ???? ??? ?????. <br>";
if ($newcreaturehp < 1)
{
echo "??????? ???? " . $creature . "???? ";
$updatecreature="DELETE from creatures where name='$creature' limit 1";
mysql_query($updatecreature);
echo "<a href='battle.php>???? ?????";
exit;
}
$updatecreature="update creatures set hpoints ='$newcreaturehp' where name='$creature'";
mysql_query ($updatecreature);
}
else
{
echo $playerinfo3['name'] . "????? ?? ???? ! <br>";
}
echo "<u> " . $crature . "????? </u><br>";
$creatureattack = rand(1,20) + $creatureattack;
$playerdefence = rand(1,20) + $playerdefence;
echo $creature . "????? " . $creatureattack. "<br>";
echo $playerinfo3['name'] . "???? " . $playerdefence . "<br>";

if ($creatureattack > $playerdefence)
{
echo $creature . " ???? ! <br>";
$creaturedamage= rand(1,6);
$newplayerhp = $playerhp - $creaturedamage;
echo "???? ???? ?? ". $creaturedamege . "?????? ???? ??? ????? . <br>";
if ($newplayerhp <1)
{
echo $playerinfo3['name'] . " ???? <br>";
echo "<a href='gameover.php> ????... ";
exit;
}
$updateplayer = "update plauer set hpoints = '$newplayerhp' where name='player1'";
mysql_query ($updateplayer);
}
else
{
echo $creature . "????? ?? ???? !";
}
echo "<br><br><a href='battle.php?creature=$creature>???? ??? !";
?>
Lord Rahl
Posts: 93
Joined: Fri May 17, 2013 2:51 pm

Re: help with attack page :(

Post by Lord Rahl »

Line 31 is missing a " ; ". May not solve the problem ref: hallsofvallhalla's post.
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: help with attack page :(

Post by Jackolantern »

Error 500 may even be a configuration problem with the server. A missing semicolon should be a PARSE_ERROR.
The indelible lord of tl;dr
Lord Rahl
Posts: 93
Joined: Fri May 17, 2013 2:51 pm

Re: help with attack page :(

Post by Lord Rahl »

Jackolantern wrote:Error 500 may even be a configuration problem with the server. A missing semicolon should be a PARSE_ERROR.
I've actually seen a poor setup mean that such parse error's resulted in a 500 error before. Don't ask how they got there because I was completely lost as to why. :lol:
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: help with attack page :(

Post by Jackolantern »

Lord Rahl wrote:
Jackolantern wrote:Error 500 may even be a configuration problem with the server. A missing semicolon should be a PARSE_ERROR.
I've actually seen a poor setup mean that such parse error's resulted in a 500 error before. Don't ask how they got there because I was completely lost as to why. :lol:
Yeah, that is really weird lol.
The indelible lord of tl;dr
Post Reply

Return to “Beginner Help and Support”