Browser MMO Video #7

Location of the Videos
Aerithcal
Posts: 12
Joined: Fri Aug 10, 2012 10:09 am

Re: Browser MMO Video #7

Post by Aerithcal »

Thanks for the code, real usefull :D
User avatar
OldRod
Posts: 1320
Joined: Sun Sep 20, 2009 4:26 pm

Re: Browser MMO Video #7

Post by OldRod »

Just remember, anything you can do in HTML, you can do in PHP with an ECHO statement :)
User avatar
Sharlenwar
Posts: 523
Joined: Mon May 28, 2012 7:14 pm

Re: Browser MMO Video #7

Post by Sharlenwar »

OldRod wrote:Just remember, anything you can do in HTML, you can do in PHP with an ECHO statement :)
And a PRINT statement too, they are the same no?
Deep within the Void of Quasion, a creation.

**My Corner of the Web**
***NEW***GrindFest - My own PHP/MySQL game!
Sharlenwar's Adventures
Torn-City - Massively multiplayer online text based RPG
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Browser MMO Video #7

Post by Jackolantern »

Well...kind of, but no at the same time ;) PRINT returns a value: TRUE if the value was printed, or FALSE if there was a problem. Since returning this value takes a tiny particle of CPU power more than ECHO for something almost no one ever needs, most people strictly stick to ECHO.
The indelible lord of tl;dr
User avatar
Sharlenwar
Posts: 523
Joined: Mon May 28, 2012 7:14 pm

Re: Browser MMO Video #7

Post by Sharlenwar »

Okay, cool. That is interesting. Thanks for that tidbit.
Deep within the Void of Quasion, a creation.

**My Corner of the Web**
***NEW***GrindFest - My own PHP/MySQL game!
Sharlenwar's Adventures
Torn-City - Massively multiplayer online text based RPG
Skippy1300
Posts: 12
Joined: Thu Aug 01, 2013 10:55 pm

Re: Browser MMO Video #7

Post by Skippy1300 »

Ok so I have followed the tutorials without any problem but it was until I reached this one where I'm stumped and I can't figure out what's wrong. Whenever I try to go to the store and buy something, I get the message "Could not insert into backpack". I've looked over the buyitem.php over and over again and yet I can"t find the problem. What codes should I post on the forums that might have the problem?
User avatar
hallsofvallhalla
Site Admin
Posts: 12023
Joined: Wed Apr 22, 2009 11:29 pm

Re: Browser MMO Video #7

Post by hallsofvallhalla »

post the code where the issue is at.
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Browser MMO Video #7

Post by Jackolantern »

If all else fails, just post the entire script for the page where the problem occurs. We can search out the string error message, and work backwards from there :)
The indelible lord of tl;dr
Skippy1300
Posts: 12
Joined: Thu Aug 01, 2013 10:55 pm

Re: Browser MMO Video #7

Post by Skippy1300 »

buyitem.php

Code: Select all

<?php
include_once 'connect.php';
session_start();

if (isset($_SESSION['player']))
{
$player=$_SESSION['player'];
}
else
{
echo "Not logged in <br><br> <A href='login.php'>Login</a>";
exit;
}

$enemies=$_GET['enemies'];
$randid=$_GET['randid'];

$playerinfo="SELECT * from players where name='$player'";
$playerinfo2=mysql_query($playerinfo) or die("could not get player stats!");
$playerinfo3=mysql_fetch_array($playerinfo2);

$playerid = $playerinfo3['id'];

$iteminfo="SELECT * from store where randid='$randid'";
$iteminfo2=mysql_query($iteminfo) or die("could not get item stats!");
$iteminfo3=mysql_fetch_array($iteminfo2);

$name = $iteminfo3['name'];
$stats = $iteminfo3['stats'];
$statadd = $iteminfo3['statadd'];
$type = $iteminfo3['type'];
$randid2 = rand(1000,999999999);

$itembought = "INSERT into inventory(id, name, stats, statadd, randid,type) VALUES ('$playerid','$name','$stats','$statadd','$randid2','$type')";
mysql_query($itembought) or die("could not insert item into backpack");

echo $name . " scavenged";
echo "<center><A href='battle.php?enemies=$enemies'>Go Back</center>";

?>
My game is going to be more about zombies and survival and stuff so that is why you "scavenge" for stuff instead of buy and creatures was changed to enemies on all scripts and in the database
Skippy1300
Posts: 12
Joined: Thu Aug 01, 2013 10:55 pm

Re: Browser MMO Video #7

Post by Skippy1300 »

I'm pretty sure that the problem is not in this code though.... should I post the battle.php? or the store.php?
Post Reply

Return to “Older Browser MMO Videos”