Browser MMO video #8

Location of the Videos
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: video#8

Post by hallsofvallhalla »

show us the page in the browser, screenshot
Urbanzkopf
Posts: 7
Joined: Sat Dec 10, 2011 1:28 am

Re: video#8

Post by Urbanzkopf »

UPDATE: Before I went offline last night I managed to get it to work for one of my pages and semi for the other.

This is showing my login page where the CSS is working perfectly
Untitled.jpg
This is the page I am having trouble with, I cannot move the logo at the top or the links to the left/middle without the whole page moving... or nothing happening at all.
Untitled2.jpg

Here is also my new battle.php code, Idk if I have to wrong end of the stick with this CSS but I'm finding it a lot harder than any of the other stuff :P

Code: Select all

<?php
include_once 'Connect.php';
session_start();
?>
<div id="logo" div align="center">
<link rel="stylesheet" type="text/css" href="style1.css" />
<?php
include_once 'logo.php';
?>
</div>
<div id="style" div align="center">
<link rel="stylesheet" type="text/css" href="style1.css" />
</div>
<?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);

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

    ////////////////new for video 7///////////////
    if (isset($_GET['randid']))
    {
       $randid=$_GET['randid'];
       $iteminfo="SELECT * from inventory where randid='$randid'";
    $iteminfo2=mysql_query($iteminfo) or die("could not get item stats!");
    $iteminfo3=mysql_fetch_array($iteminfo2);

    if (!$iteminfo3['name'])
    {
    }
    else
    {

    $name = $iteminfo3['name'];
    $stats = $iteminfo3['stats'];
    $statadd = $iteminfo3['statadd'];
    $type = $iteminfo3['type'];

    if ($type == "healing")
    {
       $newhp = $statadd + $playerhp;
       if ($newhp > $playerinfo3['maxhp'])
       {
        $newhp = $playerinfo3['maxhp'];
       }
        $updateplayer="update players set hitpoints='$newhp' where name='$player'";
      mysql_query($updateplayer) or die("Could not update player");

        $updateitem="DELETE from inventory where name='$name' AND randid='$randid' limit 1";
      mysql_query($updateitem) or die("Could not delete item");
       
       $playerhp = $newhp;
     
      echo "Used " . $name . " and recovered " . $statadd . ".<br>";
    }

    }}
    ////////////////////////////////



    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['hitpoints'];
    $creatureattack = $creatureinfo3['attack'];
    $creaturedefense = $creatureinfo3['defense'];

    ?>
    <div id="player" div align="center">
    <link rel="stylesheet" type="text/css" href="style1.css" />
    <?php
    /////player info
    echo "<u> " . $playerinfo3['name'] . "</u><br>";
    echo "Hit points = " . $playerhp . "<br>";
    echo "Attack = " . $playerattack . "<br>";
    echo "Defense = " . $playerdefense . "<br><br><br>";
    ?>
    </div>
    <div id="creature" div align="center">
    <link rel="stylesheet" type="text/css" href="style1.css" />
    <?php



    ///////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!";
      ?>
      </div>

     <div id="" div align="center">
     <link rel="stylesheet" type="text/css" href="style1.css" />

    <?php
    echo "<br><a href='useitem.php?creature=$creature'>Use Item";
    echo "<br><a href='store.php?creature=$creature'>Go to Store";
    echo "<br><a href='playerprofile.php?creature=$creature'>Go to Profile";
    ?>
    </div>

    <div id="logout" div align="left">
    <link rel="stylesheet" type="text/css" href="style1.css" />
    <?php
    echo "<br><a href='logout.php'><img src='logout.jpg'>";
    ?>
    </div>







    </div>

EDIT: @Jacko - Sorry for being a complete newb, I've only been doing this php / html stuff for 3 days so I don't quite understand what you are asking of me... If you could explain in a bit dumber terms (to help my tiny brain :)) I might just be able to answer you.
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: video#8

Post by Jackolantern »

No problem lol!

Basically, on one of the times when the CSS doesn't work, right-click your page and choose the "View Page Source" option. That will bring up all of the final HTML your PHP generated. Post that HTML source, and I think we will see the problem.
The indelible lord of tl;dr
Urbanzkopf
Posts: 7
Joined: Sat Dec 10, 2011 1:28 am

Re: video#8

Post by Urbanzkopf »

Be prepared to think "wow wtf noob >_>" :P I feel like your going to find all sorts wrong with it xD

Code: Select all

<div id="login"><div align="center"><img src="Logo3.jpg" width="150" height="100" border="0"<div id="logo" div align="center">
<link rel="stylesheet" type="text/css" href="style1.css" />
</div>

    <div id="player" div align="center">
    <link rel="stylesheet" type="text/css" href="style1.css" />
    <u> Urbanzkopf</u><br>Hit points = 19<br>Attack = 5<br>Defense = 5<br><br><br>    </div>

    <div id="creature" div align="center">
    <link rel="stylesheet" type="text/css" href="style1.css" />
    <u> orc</u><br>Hit points = 15<br>Attack = 6<br>Defense = 6<br><br><br><a href='attack.php?creature=orc'>Attack!      </div>

     <div id="name" div align="center">
     <link rel="stylesheet" type="text/css" href="style1.css" />

     </div>
    <br><a href='useitem.php?creature=orc'>Use Item<br><a href='store.php?creature=orc'>Go to Store<br><a href='playerprofile.php?creature=orc'>Go to Profile

    <div id="logout" div align="left">
    <link rel="stylesheet" type="text/css" href="style1.css" />
    <br><a href='logout.php'><img src='logout.jpg'>










User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: video#8

Post by Jackolantern »

Yes, this is a mess hehe :)

What you need to do is "frame" your PHP content into a proper HTML document. Here is the simplest example of an HTML skeleton (using HTML5):

Code: Select all

<!DOCTYPE html>
<html>
<head>
	<meta charset=utf-8 />
	<title>Sample HTML5 skeleton</title>
	<link rel="stylesheet" type="text/css" media="screen" href="css/master.css" />
	<script type="text/javascript" src="/libs/jquery/1.3.2/jquery.min.js"></script>	
</head>
<body>
 
</body>
</html>
See where the CSS link tag goes? A sample javascript script tag is there, too, to see how you add that. The real content of your page goes inside the body tags.

Note that you don't have to use all the high-end features and functions of HTML5 to use the document style. I mention this because if you Google HTML5, you will likely find all kinds of stuff that is way over your head at the moment, but don't worry about any of that. The HTML5 skeleton is the easiest to type, the easiest to remember, and the basic skeleton is understood perfectly in all modern browsers.

Here is an example of an older HTML document, using XHTML. You will notice quickly it is much more complex, even without the CSS and JS links, and basically impossible to memorize:

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
	<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
	<meta name="author" content="some name" />

	<title>Untitled 3</title>
</head>

<body>

</body>
</html>
The indelible lord of tl;dr
Urbanzkopf
Posts: 7
Joined: Sat Dec 10, 2011 1:28 am

Re: video#8

Post by Urbanzkopf »

Ahhh I see I did wonder why I saw those <html> and <body> tags but had no idea where they were supposed to go :lol: wow how embarrassing.. Thanks for explaining to me I understand this more now than I did 12 hours ago :)
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: video#8

Post by Jackolantern »

No need to be embarrassed :)

One thing I will say is you may want to spend time learning HTML before learning PHP, as it is basically a requirement to use PHP. It isn't that hard, though, and you can really learn all you need to know in a day or two and be back on track with PHP :) Here is a pretty good tutorial series if you want to check it out!
The indelible lord of tl;dr
Urbanzkopf
Posts: 7
Joined: Sat Dec 10, 2011 1:28 am

Re: video#8

Post by Urbanzkopf »

Thanks for all the help, got a lot of work to do this week but if i can squeeze it in I will try to learn html before the weekend. I hope I can pick it up as fast as I did php, thanks again for the link and the help :) muvh appreciated.
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: video#8

Post by Jackolantern »

HTML is like...1/1000th as hard as learning PHP lol ;)
The indelible lord of tl;dr
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: video#8

Post by hallsofvallhalla »

hmm maybe I should do a HTML video as well.

Thanks for helping him out Jack
Post Reply

Return to “Older Browser MMO Videos”