Error .... right syntax to use near ' 0, '1',

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • icemaster451
    New Member
    • Apr 2010
    • 5

    Error .... right syntax to use near ' 0, '1',

    Hello im making a browser game and have 99% working but iv got one error i cant find / fix and would like to know if anyone can help me where im going wrong heres the error
    Code:
    QUERY ERROR: 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 ' 0, '1', '2121221', '1212121', '12121', '12121', 1211, '121', 121)' at line 1
    Query was INSERT INTO crimes (crimeNAME, crimeBRAVE, crimePERCFORM, crimeSUCCESSMUNY, crimeSUCCESSCRYS, crimeSUCCESSITEM, crimeGROUP, crimeITEXT, crimeSTEXT, crimeFTEXT, crimeJTEXT, crimeJAILTIME, crimeJREASON, crimeXP) VALUES( 'fdfdf', '1', '((WILL*0.8)/2.5)+(LEVEL/4)', '12', , 0, '1', '2121221', '1212121', '12121', '12121', 1211, '121', 121)
    Code:
    '12', , 0, '1', '2121221', '1212121', '12121', '12121', 1211, '121', 121
    this is where i would write but for the testing i did anything

    here is the coding to the table in mysql
    Code:
    CREATE TABLE `crimes` (
      `crimeID` int(11) NOT NULL auto_increment,
      `crimeNAME` varchar(255) NOT NULL default '',
    
      `crimeBRAVE` int(11) NOT NULL default '0',
      `crimePERCFORM` text NOT NULL,
      `crimeSUCCESSMUNY` int(11) NOT NULL default '0',
      `crimeSUCCESSCRYS` int(11) NOT NULL default '0',
    
      `crimeSUCCESSITEM` int(11) NOT NULL default '0',
      `crimeGROUP` int(11) NOT NULL default '0',
      `crimeITEXT` int(11) NOT NULL default '0',
      `crimeSTEXT` int(11) NOT NULL default '0',
      `crimeFTEXT` int(11) NOT NULL default '0',
    
      `crimeJTEXT` int(11) NOT NULL default '0',
      `crimeJAILTIME` int(10) NOT NULL default '0',
      `crimeJREASON` varchar(255) NOT NULL default '0',
      `crimeXP` int(11) NOT NULL default '0',
    
      PRIMARY KEY  (`crimeID`)
    ) ENGINE=MyISAM  ;
    errors i get on page using
    Code:
    <?php 
    error_reporting(E_ALL); 
    ini_set('display_errors', true);
    Code:
    Notice: Undefined index: HTTP_X_FORWARDED_FOR in /home/reddr431/public_html/smoke/header.php on line 111
    
    Notice: Undefined index: attacking in /home/reddr431/public_html/smoke/header.php on line 120
    full code for this is attached below
    been trying to fix this for a few weeks now
    Attached Files
  • guillermobytes
    New Member
    • Jan 2010
    • 77

    #2
    maybe the error is related to the type.Could be you are passing a integer or a string where MySQL is expecting the other type.

    Comment

    • icemaster451
      New Member
      • Apr 2010
      • 5

      #3
      Originally posted by guillermobytes
      maybe the error is related to the type.Could be you are passing a integer or a string where MySQL is expecting the other type.
      nope tryed changeing it around been looking alot of forums but still no answer

      Comment

      • guillermobytes
        New Member
        • Jan 2010
        • 77

        #4
        sorry i didn't look at the code, now i see the error, it's the VALUE of crimeSUCCESSCRY S that is not set in the query values.
        It may be related to the missing index "attacking" on line 120 in /home/reddr431/public_html/smoke/header.php

        Comment

        • icemaster451
          New Member
          • Apr 2010
          • 5

          #5
          Originally posted by guillermobytes
          sorry i didn't look at the code, now i see the error, it's the VALUE of crimeSUCCESSCRY S that is not set in the query values.
          It may be related to the missing index "attacking" on line 120 in /home/reddr431/public_html/smoke/header.php
          crimeSUCCESSCRY S` int(11) NOT NULL default '0',

          Comment

          • guillermobytes
            New Member
            • Jan 2010
            • 77

            #6
            the problem is not the table, its the query
            Code:
            Query was INSERT INTO crimes (crimeNAME, crimeBRAVE, crimePERCFORM, crimeSUCCESSMUNY, crimeSUCCESSCRYS, crimeSUCCESSITEM, crimeGROUP, crimeITEXT, crimeSTEXT, crimeFTEXT, crimeJTEXT, crimeJAILTIME, crimeJREASON, crimeXP) VALUES( 'fdfdf', '1', '((WILL*0.8)/2.5)+(LEVEL/4)', '12', [B]MISSING_VALUE[/B], 0, '1', '2121221', '1212121', '12121', '12121', 1211, '121', 121)
            you have no value in crimeSUCCESSCRY S
            see where i put MISSING_VALUE

            Comment

            • icemaster451
              New Member
              • Apr 2010
              • 5

              #7
              ok done the input again with missing value and still have the error
              Code:
              QUERY ERROR:
              Query was INSERT INTO 'crimes' ('crimeNAME', 'crimeBRAVE', 'crimePERCFORM', 'crimeSUCCESSMUNY', 'crimeSUCCESSCRYS', 'crimeSUCCESSITEM', 'crimeGROUP', 'crimeITEXT', 'crimeSTEXT', 'crimeFTEXT', 'crimeJTEXT', 'crimeJAILTIME', 'crimeJREASON', 'crimeXP') VALUES( 'name', '1', '((WILL*0.8)/2.5)+(LEVEL/4)', '12', 0, 0, '1', 'intal text', 'success text', 'failure', 'jail', 12, 'reason', 12)

              Comment

              • Dormilich
                Recognized Expert Expert
                • Aug 2008
                • 8694

                #8
                maybe it’s because you want to pass a string to an integer field?

                Comment

                • icemaster451
                  New Member
                  • Apr 2010
                  • 5

                  #9
                  Originally posted by Dormilich
                  maybe it’s because you want to pass a string to an integer field?
                  problem fixed it was a simple code error

                  this
                  Code:
                  INSERT INTO crimes
                  should have been
                  Code:
                  INSERT INTO .crimes
                  i was missing a '.' from the code all works now thanks for your help guys

                  Comment

                  • guillermobytes
                    New Member
                    • Jan 2010
                    • 77

                    #10
                    Originally posted by icemaster451
                    problem fixed it was a simple code error

                    this
                    Code:
                    INSERT INTO crimes
                    should have been
                    Code:
                    INSERT INTO .crimes
                    i was missing a '.' from the code all works now thanks for your help guys
                    wow i have never seen that, plus the error output wasn't redirecting to this part of the code. wierd but glad you solved it

                    Comment

                    Working...