Page 10 of 12
Re: Browser MMO Video #7
Posted: Tue Aug 14, 2012 1:44 pm
by Aerithcal
Thanks for the code, real usefull

Re: Browser MMO Video #7
Posted: Tue Aug 14, 2012 2:15 pm
by OldRod
Just remember, anything you can do in HTML, you can do in PHP with an ECHO statement

Re: Browser MMO Video #7
Posted: Tue Aug 14, 2012 2:55 pm
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?
Re: Browser MMO Video #7
Posted: Tue Aug 14, 2012 8:07 pm
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.
Re: Browser MMO Video #7
Posted: Wed Aug 15, 2012 7:40 am
by Sharlenwar
Okay, cool. That is interesting. Thanks for that tidbit.
Re: Browser MMO Video #7
Posted: Thu Aug 01, 2013 11:05 pm
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?
Re: Browser MMO Video #7
Posted: Fri Aug 02, 2013 12:20 am
by hallsofvallhalla
post the code where the issue is at.
Re: Browser MMO Video #7
Posted: Fri Aug 02, 2013 4:53 am
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

Re: Browser MMO Video #7
Posted: Fri Aug 02, 2013 11:18 pm
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
Re: Browser MMO Video #7
Posted: Sat Aug 03, 2013 1:17 am
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?