Browser MMO Video #14
- Justeenoman
- Posts: 16
- Joined: Sun Aug 22, 2010 2:21 pm
Re: Video 14
once I buy a weapon, I get the error "Notice: Undefined index: local in C:\wamp\www\tutorial\equipped.php on line 27"
- hallsofvallhalla
- Site Admin
- Posts: 12026
- Joined: Wed Apr 22, 2009 11:29 pm
Re: Video 14
post your equipped.php
- Justeenoman
- Posts: 16
- Joined: Sun Aug 22, 2010 2:21 pm
Re: Video 14
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>
- hallsofvallhalla
- Site Admin
- Posts: 12026
- Joined: Wed Apr 22, 2009 11:29 pm
Re: Video 14
change this
to this
Code: Select all
$type=$_GET['type'];
$local=$_GET['local'];
$randid=$_GET['randid'];
Code: Select all
if(isset($_GET['type'])) {$type=$_GET['type'];}
if(isset($_GET['local'])) {$local=$_GET['local'];}
if(isset($_GET['randid'])) {$randid=$_GET['randid'];}
- Justeenoman
- Posts: 16
- Joined: Sun Aug 22, 2010 2:21 pm
Re: Video 14
Thank you sooo much. It worked!
Re: Video 14
i got an isue with statpanel.php and index.php i think



- hallsofvallhalla
- Site Admin
- Posts: 12026
- Joined: Wed Apr 22, 2009 11:29 pm
Re: Video 14
change
to
and so on with the others
also add at top of page somewhere
Code: Select all
$playerinfo3[level]
Code: Select all
$playerinfo3['level']
also add
Code: Select all
$bypass = 0;
Re: Video 14
hey,
you didn't mention about playermagic in the database, is it the same as player weapons? like is it the same structure?
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
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. 

Re: Video 14
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 

Languages: C++, C#, Javascript + Angular, PHP
Programs: Webstorm 2017, Notepad++, Photoshop
Current Project: HP Destiny
Programs: Webstorm 2017, Notepad++, Photoshop
Current Project: HP Destiny