Page 6 of 7

Re: Video 14

Posted: Thu Aug 26, 2010 12:34 am
by Justeenoman
once I buy a weapon, I get the error "Notice: Undefined index: local in C:\wamp\www\tutorial\equipped.php on line 27"

Re: Video 14

Posted: Thu Aug 26, 2010 2:21 pm
by hallsofvallhalla
post your equipped.php

Re: Video 14

Posted: Thu Aug 26, 2010 9:45 pm
by Justeenoman
I dont know what happened, but when I equip an item, it says the same error..... It doesn't say it anymore when I buy one.

Code: Select all

<?php
include_once 'connect.php';
 session_start();
   include_once 'logo.php';
   ?>
     <link href="style.css" rel="stylesheet" type="text/css" />
<?php
if (isset($_SESSION['player']))
{
  $player=$_SESSION['player'];
}
else
{
  echo "Not Logged in <br><br> <A href='login.php'>Login</a>";
  exit;
}
$playerinfo="SELECT * from players where name='$player'";
$playerinfo2=mysql_query($playerinfo) or die("could not get player stats!");
$playerinfo3=mysql_fetch_array($playerinfo2);
include_once 'statpanel.php';
$id=$playerinfo3['id'];
?>
</div>
<div id="table">
 <?php
	    $type=$_GET['type'];
		$local=$_GET['local'];
	   $randid=$_GET['randid'];
	  
	   if ($type=="w")
	   {
	 $updateequip="Update playerweapons SET equip=0 WHERE pid='$id' AND equip=1";
	    mysql_query($updateequip) or die("Could not update equipment");	
		 $reequip="Update playerweapons set equip=1 where pid='$id' AND randid='$randid'";
	    mysql_query($reequip) or die("Could not update equipment2");	
		
		echo "<center><big><big>Weapon Equipped<br></big></big>";
		echo "<br><A href='index.php'>Go back</a>";
		}
		
		if ($type=="a")
	  {
	   	 $updateequip="Update playerarmor SET equip=0 WHERE pid='$id' AND equip=1 AND location='$local'";
	    mysql_query($updateequip) or die("Could not update armor");	
		
		 
		 $reequip="Update playerarmor set equip=1 where pid='$id' AND randid='$randid' AND location='$local'";
	    mysql_query($reequip) or die("Could not update armor2");	
		
		echo "<center><big><big>Armor Equipped<br></big></big>";
		echo "<br><A href='index.php'>Go back</a>";
		}
  
  ?>

</div>

 

Re: Video 14

Posted: Thu Aug 26, 2010 10:15 pm
by hallsofvallhalla
change this

Code: Select all

 $type=$_GET['type'];
      $local=$_GET['local'];
      $randid=$_GET['randid'];
to this

Code: Select all

 if(isset($_GET['type'])) {$type=$_GET['type'];}
  if(isset($_GET['local'])) {$local=$_GET['local'];}
   if(isset($_GET['randid'])) {$randid=$_GET['randid'];}

Re: Video 14

Posted: Thu Aug 26, 2010 10:22 pm
by Justeenoman
Thank you sooo much. It worked!

Re: Video 14

Posted: Wed May 04, 2011 9:14 am
by Boo
i got an isue with statpanel.php and index.php i think :shock:
Image

Re: Video 14

Posted: Sun May 08, 2011 2:03 pm
by hallsofvallhalla
change

Code: Select all

 $playerinfo3[level]
to

Code: Select all

$playerinfo3['level']
and so on with the others

also add

Code: Select all

$bypass = 0;
at top of page somewhere

Re: Video 14

Posted: Tue Jul 19, 2011 3:39 pm
by Kevin1230
hey,

you didn't mention about playermagic in the database, is it the same as player weapons? like is it the same structure?

Re: Video 14

Posted: Wed Aug 03, 2011 6:22 am
by Animosity
Hey Halls, you have done a really great job, sorry I'm coming into all this really late in its development, but in a way its good that I am, now I don't have to wait for the next video, lol. I tried your link here for the source codes, but its saying that its expired or has been deleted by you, I'm not really too concerned about it. I will just continue the videos and add it all later. I had been writing it all out then, typing it out, which helped me learn a lot. So anyway, great job man and am very glad you are helping everyone learn php and mysql to build a Browser based game its great and I hope you keep up the great work as I follow along, hopefully with out a need to ask for help. :D

Re: Video 14

Posted: Wed Aug 03, 2011 6:42 am
by 62896dude
That's good that you have been actually writing the code, it is a WAY more efficient method of learning and truly understanding the code than just downloading the source and moving on thinking it will be a piece of cake. Props to you mate :)