Help Me With My Problem [Solved]

Location of the Videos
Post Reply
amir
Posts: 6
Joined: Wed Mar 21, 2012 8:46 am

Help Me With My Problem [Solved]

Post by amir »

Hello , I'm New On Forum
I have Problem With Battle.php:
When I test it i see this page ( I don't see player info )

Image


This is My battle.php Code

Code: Select all

<?php
include 'connect.php';




$playerinfo="SELECT * from players where name='player1'";
$playerinfo2=mysql_query($playerinfo) or die("could not get player stats!");
$playerinfo3=mysql_fetch_array($playerinfo2);

$playerhp = $playerinfo3['hpoints'];
$playerattack = $playerinfo3['attack'];
$playerdefense = $playerinfo3['defense'];

if (isset($_GET['creature']))
{
   $creature=$_GET['creature'];
   $creatureinfo="SELECT * from creatures where name = '$creature'";
$creatureinfo2=mysql_query($creatureinfo) or die("could not get the creature you were fighting!");
$creatureinfo3=mysql_fetch_array($creatureinfo2);

}
else
{
  $creatureinfo="SELECT * from creatures order by rand() limit 1";
$creatureinfo2=mysql_query($creatureinfo) or die("could get a creature!");
$creatureinfo3=mysql_fetch_array($creatureinfo2);
}

$creature = $creatureinfo3['name'];
$creaturehp = $creatureinfo3['hpoints'];
$creatureattack = $creatureinfo3['attack'];
$creaturedefense = $creatureinfo3['defense'];

/////player info
echo "<u> " . $playerinfo3['name'] . "</u><br>";
echo "Hit points = " . $playerhp . "<br>";
echo "Attack = " . $playerattack . "<br>";
echo "Defense = " . $playerdefense . "<br><br><br>";

///////creature info
echo "<u> " . $creatureinfo3['name'] . "</u><br>";
echo "Hit points = " . $creaturehp . "<br>";
echo "Attack = " . $creatureattack . "<br>";
echo "Defense = " . $creaturedefense . "<br><br><br>";

echo "<a href='attack.php?creature=$creature'>Attack!";

?>
Thank You
Last edited by amir on Thu Mar 22, 2012 12:30 pm, edited 2 times in total.
(: (Please excuse my bad English) :)
User avatar
Chris
Posts: 1581
Joined: Wed Sep 30, 2009 7:22 pm

Re: Help Me With My Problem

Post by Chris »

Does player1 exist?

After line 9:

Code: Select all

$playerinfo3=mysql_fetch_array($playerinfo2); 
place this (line 10)

Code: Select all

echo "player1 exists: " . mysql_num_rows($playerinfo3); 
if it says "player1 exists: 0", that's your problem.
Fighting for peace is declaring war on war. If you want peace be peaceful.
amir
Posts: 6
Joined: Wed Mar 21, 2012 8:46 am

Re: Help Me With My Problem

Post by amir »

solved .Thank you so much :)
When You said That Does player1 exist , i checked again and i had spelling mistake (palyer1) then i change it to player1
Thanks
(: (Please excuse my bad English) :)
amir
Posts: 6
Joined: Wed Mar 21, 2012 8:46 am

Re: Help Me With My Problem

Post by amir »

Chris wrote:Does player1 exist?

After line 9:

Code: Select all

$playerinfo3=mysql_fetch_array($playerinfo2); 
place this (line 10)

Code: Select all

echo "player1 exists: " . mysql_num_rows($playerinfo3); 
if it says "player1 exists: 0", that's your problem.

solved .Thank you so much
When You said That Does player1 exist , i checked again and i had spelling mistake (palyer1) then i change it to player1
Thanks
(: (Please excuse my bad English) :)
User avatar
SpiritWebb
Posts: 3107
Joined: Sun Jul 12, 2009 11:25 pm

Re: Help Me With My Problem

Post by SpiritWebb »

If this is solved, please edit your first post and place [solved] in the subject. Thanks!
Image

Image
Post Reply

Return to “Older Browser MMO Videos”