Browser MMO Video#11

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

Re: Browser MMO Video#11

Post by hallsofvallhalla »

What does your players enemies column show in the DB?
Skippy1300
Posts: 12
Joined: Thu Aug 01, 2013 10:55 pm

Re: Browser MMO Video#11

Post by Skippy1300 »

id name hpoints attack defense level experience
1 zombie 5 3 3 1 15
2 big zombie 10 6 6 1 30
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Browser MMO Video#11

Post by hallsofvallhalla »

No I mean for the player, In the players table.
Skippy1300
Posts: 12
Joined: Thu Aug 01, 2013 10:55 pm

Re: Browser MMO Video#11

Post by Skippy1300 »

oops sorry.
under the 'enemies' tab there is a 2 so the big zombie is suppose to appear and it did when the 'enemies' tab was 0 and i went to battle.php for the first time... the 'enemies tab changed to 2 and i saw the big zombie but when i hit refresh or go back to index and then back to battle.php, it shows im fighting nothing but the 'enemies' tab still says 2.
User avatar
MikuzA
Posts: 394
Joined: Thu Aug 08, 2013 8:57 am

Re: Browser MMO Video#11

Post by MikuzA »

Hello Skippy,

You have an interesting issue.
If you are using wamp, as in the tutorial would you mind exporting players and enemies tables?
1. Select the database of the game.
2. Export-tab
3. Export-method quick and format SQL
4. Open the SQL's in some editor, ex. notepad.
5. Look through the content so that it doesn't exist anything that you do not want show. (I mean table content).
6. Copy-paste the content into this thread.

Then we have everything in order to replicate your problem and most probably solve it.

-Mike
Why so serious?

Business Intelligence, Data Engineering, Data Mining
PHP, HTML, JavaScript, Bash/KornShell, Python, C#, PL/SQL
MySQL, DB2, Oracle, Snowflake
Pentaho, DataStage, Matillion, Unity3D, Blender
Skippy1300
Posts: 12
Joined: Thu Aug 01, 2013 10:55 pm

Re: Browser MMO Video#11

Post by Skippy1300 »

players.spl

Code: Select all

-- phpMyAdmin SQL Dump
-- version 4.0.4
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Aug 18, 2013 at 04:37 PM
-- Server version: 5.6.12-log
-- PHP Version: 5.4.12

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- Database: `zombies!!!`
--

-- --------------------------------------------------------

--
-- Table structure for table `players`
--

CREATE TABLE IF NOT EXISTS `players` (
  `id` int(9) NOT NULL AUTO_INCREMENT,
  `name` varchar(21) NOT NULL,
  `password` varchar(32) NOT NULL,
  `email` varchar(55) NOT NULL,
  `level` smallint(3) NOT NULL,
  `experience` int(11) NOT NULL,
  `money` int(11) NOT NULL,
  `enemies` int(3) NOT NULL,
  `hpoints` mediumint(7) NOT NULL,
  `maxhp` smallint(7) NOT NULL,
  `strength` mediumint(7) NOT NULL,
  `defense` mediumint(7) NOT NULL,
  `endurance` mediumint(7) NOT NULL,
  `agility` mediumint(7) NOT NULL,
  `intelligence` mediumint(7) NOT NULL,
  `charisma` mediumint(7) NOT NULL,
  `autorepair` mediumint(7) NOT NULL,
  `firebuilding` mediumint(7) NOT NULL,
  `construction` mediumint(7) NOT NULL,
  `cooking` mediumint(7) NOT NULL,
  `electricalengineering` mediumint(7) NOT NULL,
  `firstaid` mediumint(7) NOT NULL,
  `hunting` mediumint(7) NOT NULL,
  `fishing` mediumint(7) NOT NULL,
  `handtohandcombat` mediumint(7) NOT NULL,
  `lockpicking` mediumint(7) NOT NULL,
  `pistol` mediumint(7) NOT NULL,
  `shotgun` mediumint(7) NOT NULL,
  `submachinegun` mediumint(7) NOT NULL,
  `machinegun` mediumint(7) NOT NULL,
  `assaultrifle` mediumint(7) NOT NULL,
  `sniperrifle` mediumint(7) NOT NULL,
  `launcher` mediumint(7) NOT NULL,
  `lightarms` mediumint(7) NOT NULL,
  `weaponmaintenance` mediumint(7) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;

--
-- Dumping data for table `players`
--

INSERT INTO `players` (`id`, `name`, `password`, `email`, `level`, `experience`, `money`, `enemies`, `hpoints`, `maxhp`, `strength`, `defense`, `endurance`, `agility`, `intelligence`, `charisma`, `autorepair`, `firebuilding`, `construction`, `cooking`, `electricalengineering`, `firstaid`, `hunting`, `fishing`, `handtohandcombat`, `lockpicking`, `pistol`, `shotgun`, `submachinegun`, `machinegun`, `assaultrifle`, `sniperrifle`, `launcher`, `lightarms`, `weaponmaintenance`) VALUES
(1, 'player1', '098f6bcd4621d373cade4e832627b4f6', 'player1@indieresource.com', 1, 0, 0, 0, 27, 0, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
(2, 'test', '098f6bcd4621d373cade4e832627b4f6', 'test@test.com', 1, 0, 0, 0, 15, 0, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
(3, 'bob', '9f9d51bc70ef21ca5c14f307980a29d8', 'imnotreallybob.cum', 1, 0, 0, 0, 15, 15, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
(4, 'bob2', '436187b1cb437f7ddb11952542e351a4', 'stillnotbob.org', 1, 0, 0, 2, 11, 11, 6, 7, 4, 6, 3, 7, 4, 1, 1, 5, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1);

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
enemies.spl

Code: Select all

-- phpMyAdmin SQL Dump
-- version 4.0.4
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Aug 18, 2013 at 04:39 PM
-- Server version: 5.6.12-log
-- PHP Version: 5.4.12

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- Database: `zombies!!!`
--

-- --------------------------------------------------------

--
-- Table structure for table `enemies`
--

CREATE TABLE IF NOT EXISTS `enemies` (
  `id` int(3) NOT NULL AUTO_INCREMENT,
  `name` varchar(21) NOT NULL,
  `hpoints` mediumint(7) NOT NULL,
  `attack` mediumint(7) NOT NULL,
  `defense` mediumint(7) NOT NULL,
  `level` smallint(3) NOT NULL,
  `experience` int(12) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;

--
-- Dumping data for table `enemies`
--

INSERT INTO `enemies` (`id`, `name`, `hpoints`, `attack`, `defense`, `level`, `experience`) VALUES
(1, 'zombie', 5, 3, 3, 1, 15),
(2, 'big zombie', 10, 6, 6, 1, 30);

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Browser MMO Video#11

Post by hallsofvallhalla »

if you want to fix this fast just move on past video 14. Download the source.
User avatar
MikuzA
Posts: 394
Joined: Thu Aug 08, 2013 8:57 am

Re: Browser MMO Video#11

Post by MikuzA »

Hello Skippy,

found your problem, it seems that in battle.php your query is matching name instead of id to the $enemies ref.

Change from:

Code: Select all

if ($enemies != 0)
{
$enemiesinfo="SELECT * from enemies where name = '$enemies'";
$enemiesinfo2=mysql_query($enemiesinfo) or die("could not get the enemies you were fighting!");
$enemiesinfo3=mysql_fetch_array($enemiesinfo2);
}
Change to:

Code: Select all

$enemiesinfo="SELECT * from enemies where id = '$enemies'";
-Mike
Why so serious?

Business Intelligence, Data Engineering, Data Mining
PHP, HTML, JavaScript, Bash/KornShell, Python, C#, PL/SQL
MySQL, DB2, Oracle, Snowflake
Pentaho, DataStage, Matillion, Unity3D, Blender
Post Reply

Return to “Older Browser MMO Videos”