Jump to content
MakeWebGames

Gangs MySQL Error when creating a gang


Monkey644

Recommended Posts

Hi everyone,

I get the following error message when someone on my game tries to create a gang. I have replaced the entire gang pages and sqls with a backup copy i had, but still had no success.

 

The error message is:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'test','testing gang system','','',0,0,100,1,1,5,0,0,'')', '/creategang.php', uni' at line 2

MySQL Version is: 5.0.91-community

Can anyone help me at all?

Link to comment
Share on other sites

As requested.

 

$db->query("INSERT INTO gangs VALUES('','$name','$desc','','',0,0,100,$userid,$userid,5,0,0,'')");

 

And this is my gang table sql:

 

[mysql]CREATE TABLE IF NOT EXISTS `gangs` (

`gangID` int(11) NOT NULL auto_increment,

`gangNAME` varchar(255) NOT NULL default '',

`gangDESC` text NOT NULL,

`gangPREF` varchar(12) NOT NULL default '',

`gangSUFF` varchar(12) NOT NULL default '',

`gangMONEY` bigint(65) NOT NULL default '0',

`gangCRYSTALS` bigint(65) NOT NULL default '0',

`gangRESPECT` int(11) NOT NULL default '0',

`gangPRESIDENT` int(11) NOT NULL default '0',

`gangVICEPRES` int(11) NOT NULL default '0',

`gangCAPACITY` int(11) NOT NULL default '0',

`gangCRIME` int(11) NOT NULL default '0',

`gangCHOURS` int(11) NOT NULL default '0',

`gangAMENT` longtext NOT NULL,

`gangSIG` varchar(255) NOT NULL,

`gangSIG2` varchar(255) NOT NULL,

`gangSTATUS` text NOT NULL,

PRIMARY KEY (`gangID`)

) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=27 ;[/mysql]

Link to comment
Share on other sites

Your table has 17 fields in it. Your insert SQL only contains 13.

[mysql]

CREATE TABLE IF NOT EXISTS `gangs` (

`gangID` int(11) NOT NULL auto_increment,

`gangNAME` varchar(255) NOT NULL default '',

`gangDESC` text NOT NULL,

`gangPREF` varchar(12) NOT NULL default '',

`gangSUFF` varchar(12) NOT NULL default '',

`gangMONEY` bigint(65) NOT NULL default '0',

`gangCRYSTALS` bigint(65) NOT NULL default '0',

`gangRESPECT` int(11) NOT NULL default '0',

`gangPRESIDENT` int(11) NOT NULL default '0',

`gangVICEPRES` int(11) NOT NULL default '0',

`gangCAPACITY` int(11) NOT NULL default '0',

`gangCRIME` int(11) NOT NULL default '0',

`gangCHOURS` int(11) NOT NULL default '0',

`gangAMENT` longtext NOT NULL,

`gangSIG` varchar(255) NOT NULL,

`gangSIG2` varchar(255) NOT NULL,

`gangSTATUS` text NOT NULL,

PRIMARY KEY (`gangID`)

) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=27 ;

[/mysql]

Try this for your insert sql

[mysql]

$db->query("INSERT INTO gangs VALUES('', '$name', '$desc', '', '', 0, 0, 100, $userid, 0, 5, 0, 0, '', '', '', 0)");

[/mysql]

Link to comment
Share on other sites

$db->query("INSERT INTO gangs VALUES('', '$name', '$desc', '', '', 0, 0, 100, $userid, 0, 5, 0, 0, '', '', '', 0)");
Your table has 17 fields in it. Your insert SQL only contains 13.

[mysql]

CREATE TABLE IF NOT EXISTS `gangs` (

`gangID` int(11) NOT NULL auto_increment,

`gangNAME` varchar(255) NOT NULL default '',

`gangDESC` text NOT NULL,

`gangPREF` varchar(12) NOT NULL default '',

`gangSUFF` varchar(12) NOT NULL default '',

`gangMONEY` bigint(65) NOT NULL default '0',

`gangCRYSTALS` bigint(65) NOT NULL default '0',

`gangRESPECT` int(11) NOT NULL default '0',

`gangPRESIDENT` int(11) NOT NULL default '0',

`gangVICEPRES` int(11) NOT NULL default '0',

`gangCAPACITY` int(11) NOT NULL default '0',

`gangCRIME` int(11) NOT NULL default '0',

`gangCHOURS` int(11) NOT NULL default '0',

`gangAMENT` longtext NOT NULL,

`gangSIG` varchar(255) NOT NULL,

`gangSIG2` varchar(255) NOT NULL,

`gangSTATUS` text NOT NULL,

PRIMARY KEY (`gangID`)

) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=27 ;

[/mysql]

Try this for your insert sql

[mysql]

$db->query("INSERT INTO gangs VALUES('', '$name', '$desc', '', '', 0, 0, 100, $userid, 0, 5, 0, 0, '', '', '', 0)");

[/mysql]

OMG Your a Legend!!! Works perfectly :) Thank you all for youe help!!!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...