Page 2 of 13

Re: Video #4

Posted: Tue Jun 09, 2009 4:34 am
by kyraneth
try clicking "help", then "about" in the browser, it should show you the version you are using. Also, if you are on xp, chances are you have IE6

Re: Video #4

Posted: Tue Jun 09, 2009 9:27 am
by Falken
hallsofvallhalla wrote:what browser you using plus the version. IE5? IE6? Mozilla? ect..
Should not make a difference in this case as all PHP is processed on the server...so whatever browser that can read HTML should do fine.

Video #4

Posted: Tue Jun 09, 2009 12:20 pm
by vlaaduut
Doesn't work

"could get a creature!"

this is the message, i've been looking for mistakes but i can't find them.

Re: Video #4

Posted: Tue Jun 09, 2009 12:24 pm
by vlaaduut
sorry it was a space at the db...my bad :(

Re: Video #4

Posted: Tue Jun 09, 2009 12:51 pm
by Jesusfreak
Ok, it looks like I have internet explorer 7.0.5730.11
That's ok, right? Oh and I have a Windows XP.

Re: Video #4

Posted: Tue Jun 09, 2009 3:54 pm
by hallsofvallhalla
Falken wrote:
hallsofvallhalla wrote:what browser you using plus the version. IE5? IE6? Mozilla? ect..
Should not make a difference in this case as all PHP is processed on the server...so whatever browser that can read HTML should do fine.
yeah but the way php is interpreted by the browser after the server sends it does make a difference. I have had issues with ie5 and 6 not displaying things correctly directly from PHP.

The only way I can help you JF is if you export the database, simple just go to export then export as file and send me the .sql or take a screen shot of it. NAd then send me your php files. Just upload them to http://www.file-pasta.com/

Re: Video #4

Posted: Tue Jun 09, 2009 4:03 pm
by hallsofvallhalla
hmm that all seems to be fine. let me look into this a little further....

Re: Video #4

Posted: Tue Jun 09, 2009 5:00 pm
by Noctrine
If someone posts up one a downloadable link to an archive with the files in the right place I can find the error.

Edit: Also halls your attack script is missing an apostrophe.

Re: Video #4

Posted: Tue Jun 09, 2009 5:05 pm
by hallsofvallhalla
that would explain his error, but where is it missing?

Re: Video #4

Posted: Tue Jun 09, 2009 5:14 pm
by Noctrine

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);

	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	{
		echo "<a href='battle.php'>No Creature selected. Go Back!</a>";
		exit;
	}
	$playerhp = $playerinfo3['hpoints'];
	$playerattack = $playerinfo3['attack'];
	$playerdefense = $playerinfo3['defense'];

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


	///////////////////////players turn////////////////////

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

	echo $playerinfo3['name'] . "'s Attack roll is " . $playerattack . "<br>";
	echo $creature . "'s defense roll is " . $creaturedefense. "<br>";

	if ($playerattack > $creaturedefense){
		echo $playerinfo3['name'] . " hits! <br>";
		$playerdamage = rand(1,6);
		$newcreaturehp = $creaturehp - $playerdamage;
		echo "For " . $playerdamage . " points of damage. <br>";
		if ($newcreaturehp < 1){
			echo "The " . $creature . " has been killed";

			$updatecreature="DELETE from creatures where name='$creature' limit 1";
			mysql_query($updatecreature) or die("Could not update creature");

			echo "<a href='battle.php'>Go Back</a>";
			exit;
		}
		
		$updatecreature="update creatures set hpoints='$newcreaturehp' where name='$creature' limit 1";
		mysql_query($updatecreature) or die("Could not update creature");
	}
	else{
		echo $playerinfo3['name'] . " misses!<br>";
	}
	//////////////////////creatures turn //////////////////

	echo "<u> " . $creature . "'s Attack</u><br>";
	$creatureattack = rand(1,20) + $creatureattack;
	$playerdefense = rand(1,20) + $playerdefense;

	echo $creature . "'s Attack roll is " . $creatureattack . "<br>";
	echo $playerinfo3['name'] . "'s defense roll is " . $playerdefense . "<br>";

	if ($creatureattack > $playerdefense){
		echo $creature . " hits! <br>";
		$creaturedamage = rand(1,6);
		$newplayerhp = $playerhp - $creaturedamage;
		echo "For " . $creaturedamage . " points of damage. <br>";
		if ($newplayerhp < 1){
			echo $playerinfo3['name'] . " has been killed<br>";
			echo "<a href='gameover.php>Continue";
			exit;
		}
		$updateplayer="update players set hpoints='$newplayerhp' where name='player1'";
		mysql_query($updateplayer) or die("Could not update player");
	}
	else{
		echo $creature . " misses!";
	}
	echo "<br><br><a href='battle.php?creature=$creature'>Battle Again!</a>";
?>

Closing tags is usually good also :p