Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Query Syntax

Posted on 2015-01-28
2
Medium Priority
?
53 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 84

Accepted Solution

by:
Dave Baldwin earned 2000 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: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone 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

Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

636 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