Browser MMO Video #7
Re: Browser MMO Video #7
Thanks for the code, real usefull
Re: Browser MMO Video #7
Just remember, anything you can do in HTML, you can do in PHP with an ECHO statement
- Sharlenwar
- Posts: 523
- Joined: Mon May 28, 2012 7:14 pm
Re: Browser MMO Video #7
And a PRINT statement too, they are the same no?OldRod wrote:Just remember, anything you can do in HTML, you can do in PHP with an ECHO statement
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
**My Corner of the Web**
***NEW***GrindFest - My own PHP/MySQL game!
Sharlenwar's Adventures
Torn-City - Massively multiplayer online text based RPG
- Jackolantern
- Posts: 10891
- Joined: Wed Jul 01, 2009 11:00 pm
Re: Browser MMO Video #7
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
- Sharlenwar
- Posts: 523
- Joined: Mon May 28, 2012 7:14 pm
Re: Browser MMO Video #7
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
**My Corner of the Web**
***NEW***GrindFest - My own PHP/MySQL game!
Sharlenwar's Adventures
Torn-City - Massively multiplayer online text based RPG
-
- Posts: 12
- Joined: Thu Aug 01, 2013 10:55 pm
Re: Browser MMO Video #7
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?
- hallsofvallhalla
- Site Admin
- Posts: 12023
- Joined: Wed Apr 22, 2009 11:29 pm
Re: Browser MMO Video #7
post the code where the issue is at.
- Jackolantern
- Posts: 10891
- Joined: Wed Jul 01, 2009 11:00 pm
Re: Browser MMO Video #7
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
-
- Posts: 12
- Joined: Thu Aug 01, 2013 10:55 pm
Re: Browser MMO Video #7
buyitem.php
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
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>";
?>
-
- Posts: 12
- Joined: Thu Aug 01, 2013 10:55 pm
Re: Browser MMO Video #7
I'm pretty sure that the problem is not in this code though.... should I post the battle.php? or the store.php?