Page 11 of 12

Re: Browser MMO Video #7

Posted: Sat Aug 03, 2013 1:38 am
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)

Re: Browser MMO Video #7

Posted: Sat Aug 03, 2013 2:02 am
by hallsofvallhalla
change

Code: Select all

"could not insert item into backpack"
to

Code: Select all

mysql_error()

Re: Browser MMO Video #7

Posted: Sat Aug 03, 2013 2:03 am
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.

Re: Browser MMO Video #7

Posted: Sat Aug 03, 2013 2:07 am
by Skippy1300
I changed it to mysql_error() and I get unkown column 'statadd' in 'field list'

Re: Browser MMO Video #7

Posted: Sat Aug 03, 2013 2:10 am
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

Re: Browser MMO Video #7

Posted: Sat Aug 03, 2013 2:47 pm
by hallsofvallhalla
one day when i finish this i will change all the errors to mysql errors to help

Re: Browser MMO Video #7

Posted: Thu Dec 04, 2014 3:28 am
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"

Re: Browser MMO Video #7

Posted: Thu Dec 04, 2014 3:36 am
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?

Re: Browser MMO Video #7

Posted: Thu Dec 04, 2014 3:40 am
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;

Re: Browser MMO Video #7

Posted: Thu Dec 04, 2014 5:29 pm
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?