Browser MMO Video #7

Location of the Videos
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: Browser MMO Video #7

Post by Jackolantern »

I think you are violating a type of a MySQL column. The "Could not insert into backpack" is essentially an error message generated from MySQL complaining. Look at this line:

Code: Select all

$itembought = "INSERT into inventory(id, name, stats, statadd, randid,type) VALUES ('$playerid','$name','$stats','$statadd','$randid2','$type')";
I can assume your ID column is numeric, but putting single-quotes around it turns it into a string. Look at each of those columns you are filling, and any that expect numbers, remove the single-quotes. (I used to make this error all the time)
The indelible lord of tl;dr
User avatar
hallsofvallhalla
Site Admin
Posts: 12023
Joined: Wed Apr 22, 2009 11:29 pm

Re: Browser MMO Video #7

Post by hallsofvallhalla »

change

Code: Select all

"could not insert item into backpack"
to

Code: Select all

mysql_error()
Skippy1300
Posts: 12
Joined: Thu Aug 01, 2013 10:55 pm

Re: Browser MMO Video #7

Post by Skippy1300 »

So I think I understand what your saying and I changed my code to this:

Code: Select all

$itembought = "INSERT into inventory(id, name, stats, statadd, randid,type) VALUES ($playerid,'$name','$stats',$statadd,$randid2,'$type')";
but I still get my could not insert into backpack error.
Skippy1300
Posts: 12
Joined: Thu Aug 01, 2013 10:55 pm

Re: Browser MMO Video #7

Post by Skippy1300 »

I changed it to mysql_error() and I get unkown column 'statadd' in 'field list'
Skippy1300
Posts: 12
Joined: Thu Aug 01, 2013 10:55 pm

Re: Browser MMO Video #7

Post by Skippy1300 »

NEVERMIND I fixed the problem!! I misspelled it 'stateadd' in the inventory database :shock:
I can't believe I missed that. Anyway thank you two so much for your help and thank you Halls for the amazing tutorial. I've learned so much from you and I greatly appreciate it!!! :D
User avatar
hallsofvallhalla
Site Admin
Posts: 12023
Joined: Wed Apr 22, 2009 11:29 pm

Re: Browser MMO Video #7

Post by hallsofvallhalla »

one day when i finish this i will change all the errors to mysql errors to help
dawi03
Posts: 19
Joined: Mon Dec 01, 2014 7:48 pm

Re: Browser MMO Video #7

Post by dawi03 »

Either I have missed something but I cannot for the life of me find what part of video 6 or 7 I need to go to to find what to put in PHPmyadmin for the Store and the Item page?

As it just comes up " could not select player inventory"
User avatar
Epiales
Posts: 1119
Joined: Thu Aug 15, 2013 1:38 am

Re: Browser MMO Video #7

Post by Epiales »

dawi03 wrote:Either I have missed something but I cannot for the life of me find what part of video 6 or 7 I need to go to to find what to put in PHPmyadmin for the Store and the Item page?

As it just comes up " could not select player inventory"
So u're missing the mysql files for the store and inventory?
Nothing fancy, but a work in progress!

http://gameplaytoday.net
User avatar
Epiales
Posts: 1119
Joined: Thu Aug 15, 2013 1:38 am

Re: Browser MMO Video #7

Post by Epiales »

Code: Select all

CREATE TABLE IF NOT EXISTS `store` (
  `name` varchar(50) NOT NULL,
  `stats` varchar(30) NOT NULL,
  `statadd` smallint(3) NOT NULL,
  `price` int(11) NOT NULL,
  `amount` smallint(5) NOT NULL,
  `randid` int(9) NOT NULL,
  `type` varchar(30) NOT NULL,
  `location` varchar(31) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

Code: Select all

CREATE TABLE IF NOT EXISTS `items` (
  `name` varchar(21) NOT NULL,
  `stats` varchar(11) NOT NULL,
  `statadd` smallint(3) NOT NULL,
  `price` int(11) NOT NULL,
  `type` varchar(21) NOT NULL,
  KEY `name` (`name`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

Code: Select all

CREATE TABLE IF NOT EXISTS `inventory` (
  `id` int(11) NOT NULL,
  `name` varchar(50) NOT NULL,
  `stats` varchar(30) NOT NULL,
  `statadd` smallint(3) NOT NULL,
  `price` int(11) NOT NULL,
  `randid` int(9) NOT NULL,
  `type` varchar(30) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
Nothing fancy, but a work in progress!

http://gameplaytoday.net
dawi03
Posts: 19
Joined: Mon Dec 01, 2014 7:48 pm

Re: Browser MMO Video #7

Post by dawi03 »

Epiales wrote:

Code: Select all

CREATE TABLE IF NOT EXISTS `store` (
  `name` varchar(50) NOT NULL,
  `stats` varchar(30) NOT NULL,
  `statadd` smallint(3) NOT NULL,
  `price` int(11) NOT NULL,
  `amount` smallint(5) NOT NULL,
  `randid` int(9) NOT NULL,
  `type` varchar(30) NOT NULL,
  `location` varchar(31) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

Code: Select all

CREATE TABLE IF NOT EXISTS `items` (
  `name` varchar(21) NOT NULL,
  `stats` varchar(11) NOT NULL,
  `statadd` smallint(3) NOT NULL,
  `price` int(11) NOT NULL,
  `type` varchar(21) NOT NULL,
  KEY `name` (`name`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

Code: Select all

CREATE TABLE IF NOT EXISTS `inventory` (
  `id` int(11) NOT NULL,
  `name` varchar(50) NOT NULL,
  `stats` varchar(30) NOT NULL,
  `statadd` smallint(3) NOT NULL,
  `price` int(11) NOT NULL,
  `randid` int(9) NOT NULL,
  `type` varchar(30) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

thanks mate where do i put these thouh?
Post Reply

Return to “Older Browser MMO Videos”