Questions on the videos

Location of the Videos
User avatar
Sakar
Posts: 520
Joined: Thu Apr 23, 2009 2:59 am

Re: Questions on the videos

Post by Sakar »

First, please don't upload images in BMP format. Use JPG or PNG instead.

Second, from the little line of code you've shone it appears you have a space in between the $ and the variable name, as well as the GET. Get rid of the space and see if it works.

If that doesn't work then please post the entire code file so we can find the error.
siim
Posts: 6
Joined: Sat Oct 03, 2009 12:20 pm

Re: Questions on the videos

Post by siim »

Hi again and thanks for the tip. Now i have 1 problem more....when i trie to register then it just says "could not register".

reguser :

Code: Select all

<?php
include 'connect.php';
?>

<?php
$player=$_POST['player'];
$password=$_POST['password'];
$pass2=$_POST['pass2'];
$player=strip_tags($player);
$email=$_POST['email'];
$email=strip_tags($email);
$classchoice=$_POST['classchoice'];

if ($email == "")
{
echo "You didn't enter a email address!<br>";
echo " <A href='register.php'>Go back</a>";
exit;
}
if ($password==$pass2)
{

$isplayer="SELECT * from players where name='$player'";
$isplayer2=mysql_query($isplayer) or die("Could not query players table");
$isplayer3=mysql_fetch_array($isplayer2);

if(!$_POST['password'] || !$_POST['pass2'])
{
print "You did not enter a password<br>";
echo " <A href='register.php'>Go back</a>";
exit;
}
else if($isplayer3 || strlen($player)>21 || strlen($player)<1)
{
print "There is already a player of that name or the name you specified is over 16 letters or less than 1 letter";
echo " <A href='register.php'>Go back</a><br>";
exit;
}
else
{
$isaddress="SELECT * from players where email='$email'";
$isaddress2=mysql_query($isaddress) or die("not able to query for password");
$isaddress3=mysql_fetch_array($isaddress2);
if($isaddress3)
{
print "There is already a player with that e-mail address";
echo " <A href='register.php'>Go back</a><br>";
exit;
}
else
{
$password=md5($password);

 //////////////////////////////new for video 9//////////////
 $classquery="SELECT * from classes where name='$classchoice'";
  $classquery2=mysql_query($classquery) or die("Could not query classes");
  $classquery3=mysql_fetch_array($classquery2);

$SQL = "INSERT into players(name, password, email, level, exper, attack, defense, hpoints, maxhp, spoints, maxspoints,pclass) VALUES ('$player','$password','$email','1','0','5','5','30','30','$classquery3[attack]','$classquery3[defense]','$classquery3[hpoints]','$classquery3[hpoints]','$classquery3[spoints]','$classquery3[spoints]','$classquery3[name]')";
mysql_query($SQL) or die("could not register");

print "Thank you for registering!";

}
}
}

else
{
print "Your password didn't match or you did not enter a password";
echo " <A href='register.php'>Go back</a><br>";
exit;
}
 echo " <A href='login.php'>Login Page</a><br>";
?>
Register :

Code: Select all

<?php
include 'connect.php';

?>

<form method ="post" action="reguser.php">
Type Username Here: <input type="text" name="player" size="21"><br>
Type Password Here: <input type="text" name="password" size "15"><br>
ReType Password Again: <input type="text" name="pass2" size "15"><br>
Type Email Address: <input type="text" name="email" size "60"><br>

<input type="submit" value="submit">


 <?php
      print "<select name='classchoice' length='20'>";
      $classinfo="SELECT * from classes";
      $classinfo2=mysql_query($classinfo) or die("Could not select classes");
      while ($classinfo3=mysql_fetch_array($classinfo2))
      {
        print "<option>$classinfo3[name]</option>";
      }
      print "</select><br>";
?>
</form>
<?php

      print "<center><h3>Class Starting modifiers</h3></center>";
      print "<center>";
      print "<table border='0' width='70%' cellspacing='20'>";
      print "<tr><td width='25%' valign='top'>";
      print "</td>";
      print "<td valign='top' width='75%'>";
      $selectclass="SELECT * from classes";
      $selectclass2=mysql_query($selectclass) or die("could not select Classes");
      print "<table border='1' bordercolor='black' bgcolor='#ffffff'>";
      print "<tr><td><font color='cc0033'>Class<font color='ffffff'>_____________</td><td><font color='cc0033'>Attack<font color='ffffff'>_</font><td><font color='cc0033'>Defense<font color='ffffff'>_</font></td><td><font color='cc0033'>Hit Points<font color='ffffff'>_</font></td><td><font color='cc0033'>Spell Points<font color='ffffff'>_</font></td></tr>";
      while($selectclass3=mysql_fetch_array($selectclass2))
      {
       print "<tr><td>$selectclass3[name]</td><td>$selectclass3[attack]</td><td>$selectclass3[defense]</td><td>$selectclass3[hpoints]</td><td>$selectclass3[spoints]</td></tr>";
          
      }
      print "</table>";
      print "</td></tr></table>";    
      print "</center>";
    
    
?>
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Questions on the videos

Post by hallsofvallhalla »

make sure all the names match your database fields exactly.
siim
Posts: 6
Joined: Sat Oct 03, 2009 12:20 pm

Re: Questions on the videos

Post by siim »

Okey...all the names match and still it says could not register. In phpmyadmin there are under players : creatures and gold but not in context.
is this all right ?:

Code: Select all

$classquery="SELECT * from classes where name='$classchoice'";
$classquery2=mysql_query($classquery) or die("Could not query classes");
$classquery3=mysql_fetch_array($classquery2);

$SQL = "INSERT into players(name, password, email, level, exper, attack, defense, hpoints, maxhp, spoints, maxspoints,pclass) VALUES ('$player','$password','$email','1','0','5','5','15','100','$classquery3[attack]','$classquery3[defense]','$classquery3[hpoints]','$classquery3[hpoints]','$classquery3[spoints]','$classquery3[spoints]','$classquery3[name]')";
     mysql_query($SQL) or die("could not register");

     print "Thank you for registering!";

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

Re: Questions on the videos

Post by hallsofvallhalla »

take a screenshot of your database but save it as a jpg :) then we can go from there.
siim
Posts: 6
Joined: Sat Oct 03, 2009 12:20 pm

Re: Questions on the videos

Post by siim »

Okey...these are the screens i made and yea thanks again for helping.

http://www.upload.ee/image/214901/pla.bmp
http://www.upload.ee/image/214909/untitled.bmp
Labyrnth
Posts: 5
Joined: Wed Oct 21, 2009 12:03 am

Re: Questions on the videos

Post by Labyrnth »

Halls,

Can you link me to be able to download these videos your doing please?
I want to do this but cannot be online all the time to watch when i get to a point i need to learn something new.

Thanks man, im loving the tutorials. Im actually learning a bit of PHP because of this as well as using Sql database.
Im on video 6 now but not doing anything but watching and zipping back if i dont understand. Then i will go back and do it.
herko125
Posts: 17
Joined: Fri Oct 16, 2009 3:12 pm

Re: Questions on the videos

Post by herko125 »

i got yet a new problem...how do i solve this problem...
Image
u see at hp at sp...the squares dont fit the text...

how do i make them fit?
i tried changing CSS but no luck x.x
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Questions on the videos

Post by hallsofvallhalla »

did you change the css at the right place? Do you have a div inside of another div? Can we see the code?
herko125
Posts: 17
Joined: Fri Oct 16, 2009 3:12 pm

Re: Questions on the videos

Post by herko125 »

okay
the css is here

Code: Select all

body {
	background-color: #ffffff;
}
#login {
	position:absolute;
	left:0px;
	top:0px;
	width:800px;
	height:150px;
	z-index:1;
}
#login2 {
	position:absolute;
	left:0px;
	top:200px;
	width:800px;
	height:150px;
	z-index:1;
}
#player {
	position:absolute;
	left:400px;
	top:200px;
	width:450px;
	height:450px;
	z-index:3;
}
#creature {
	position:absolute;
	left:400px;
	top:400px;
	width:450px;
	height:650px;
	z-index:3;
}
#logout {
	position:absolute;
	left:10px;
	top:10px;
	width:150px;
	height:150px;
	z-index:3;
}
#locations {
	position:absolute;
	left:400px;
	top:100px;
	width:450px;
	height:450px;
	z-index:3;
}
#gold {
	position:absolute;
	left:200px;
	top:200px;
	width:150px;
	height:100px;
	z-index:3;
}
#lpanel {
	position:absolute;
	left:10px;
	top:120px;
	width:100px;
	height:200px;
	z-index:3;
}
#hpointsback {
	position:absolute;
	left:10px;
	top:204px;
	width:100px;
	height:15px;
	z-index:1;
}
#hpoints {
	position:absolute;
	left:10px;
	top:204px;
	width:100px;
	height:15px;
	z-index:2;
	text-align:left;
}
#spointsback {
	position:absolute;
	left:10px;
	top:225px;
	width:100px;
	height:15px;
	z-index:1;
}
#spoints {
	position:absolute;
	left:10px;
	top:225px;
	width:100px;
	height:15px;
	z-index:2;
	text-align:left;
}
#table {
	position:absolute;
	left:200px;
	top:105px;
	width:500px;
	height:900px;
	z-index:2;
}
#magic {
	position:absolute;
	left:400px;
	top:100px;
	width:450px;
	height:450px;
	z-index:3;
}
#bank {
	position:absolute;
	left:250px;
	top:105px;
	width:500px;
	height:170px;
	z-index:4;
}
and the Stat Panel

Code: Select all

<center><a href="weaponshop.php"><img src="images/weaponshop.jpg" Weapon Shop/></a>
<a href="armorshop.php"><img src="images/armorshop.jpg" Armor Shop/></a>
<a href="store.php"><img src="images/shop.jpg"Store /></a>
<a href="spelltrainer.php"><img src="images/spelltrainer.jpg" Spell Trainer/></a>
<a href="battle.php"><img src="images/arena.jpg" Arena/></a></center>
<div id="lpanel">
<br><br><br>
<?php
echo "<u><b> " . $playerinfo3['name'] . "</b></u><br>";
echo "Level: " . $playerinfo3['level'] . "<br>";
echo "Exp: " . $playerinfo3['exper'] . "<br>";
echo $playerinfo3['pclass'] . "<br>";
echo "Attack: " . $playerinfo3['attack'] . "<br>";
echo "Defense: " . $playerinfo3['defense'] . "<br>";
echo "Hit Points<br>";
echo "Spell Points<br><br>";
echo "<b><big><u>Gold</u></big></b><br>";
echo $playerinfo3['gold']."<br>";
echo "<a href='bank.php'>Bank<br></a>";
echo "<a href='equipment.php'>Equipment<br></a>";
echo "<a href='logout.php'>Logout<br></a>";
?>
</div>


<div id= "hpointsback">
<?php
echo "<img src='images/barback.gif'>";
?>
</div>

<div id= "hpoints">
<?php
$width = ($playerinfo3['hpoints'] / $playerinfo3['maxhp']) * 100;
echo "<img src='images/hpoints.gif' width='$width' height='15' >";
?>
</div>

<div id= "spointsback">
<?php
echo "<img src='images/barback.gif'>";
?>
</div>

<div id= "spoints">
<?php
$width = ($playerinfo3['spoints'] / $playerinfo3['maxspoints']) * 100;
echo "<img src='images/spoints.gif' width='$width' height='15' >";
?>
</div>

Post Reply

Return to “Older Browser MMO Videos”