Solved

Query Syntax

Posted on 2015-01-28
2
50 Views
Last Modified: 2015-03-07
I am getting the following Query Syntax error.  Can anyone tell me what I am doing wrong.?  Also, how does the error determine "line 3"?  Meaning, how does it count lines?

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 'UNSIGNED, `markel_serff_tracking` varchar UNSIGNED, `pd_base_rate` decimal UNS' at line 3

Query:
$fields = array(

				'id' => array(
					'type' => 'int',
					'constraint' => '11',
					'unsigned' => TRUE,
					'auto_incriment' => TRUE	
				),
				
				'state' => array(
					'type'=> 'varchar',
					'constraints' => '4',
					'unsigned' => TRUE,
					'auto_incriment' => FALSE
				),
				
				'markel_serff_tracking' => array(
					'type' => 'varchar',
					'constraints' => '150',
					'unsigned' => TRUE,
					'auto_incriment' => FALSE
				),
				
				'pd_base_rate' => array (
					'type' => 'decimal',
					'constraints' => '10,2',
					'unsigned' => TRUE,
					'auto_incriment' => FALSE
				)
				
				);
				
				$this->EE->dbforge->add_field($fields);
				$this->EE->dbforge->add_key('id', TRUE);
				$this->EE->dbforge->create_table('exp_state_rates');

Open in new window

0
Comment
Question by:rgranlund
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 40575851
You are spelling 'auto_incriment' wrong.  Should be 'auto_increment'.  http://dev.mysql.com/doc/refman/5.0/en/example-auto-increment.html  Auto_increment in MySQL can only be used on the primary key.

'unsigned' only applies to numeric data, not 'varchar'.  http://dev.mysql.com/doc/refman/5.0/en/numeric-type-overview.html
0
 
LVL 7

Author Comment

by:rgranlund
ID: 40575861
oh man... I just had a duhhhh moment! It's cause I'm wearing new glasses.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you find yourself in this situation “I have used SELECT DISTINCT but I’m getting duplicates” then I'm sorry to say you are using the wrong SQL technique as it only does one thing which is: produces whole rows that are unique. If the results you a…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question