Yii Framework Forum: MySQL error - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

MySQL error #1064 error Rate Topic: -----

#1 User is offline   maher 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 69
  • Joined: 31-July 12
  • Location:Edmonton

Posted 02 August 2012 - 04:01 AM

Hi

I want to add a new column in my table, and i'm always getting 1064 error.

Can someone tell yhat's wrong.

SQL Query :

 ALTER TABLE `user` 
ADD `picture` VARCHAR 
NOT NULL 
AFTER `dob` 


SQL Error
_______________________________________________________________________________
#1064 - 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 'NOT NULL AFTER `dob`' at line 3
---------------------------------------

thank you in advance
0

#2 User is offline   Maurizio Domba Cerin 

  • Yii - Yesss It Is !!!
  • Yii
  • Group: Yii Dev Team
  • Posts: 4,340
  • Joined: 12-October 09
  • Location:Croatia

Posted 02 August 2012 - 04:34 AM

NOTE: moved to proper section (Miscellaneous instead of General Discussion for Yii 1.1.x)
Find more about me.... btw. Do you know your WAN IP?
0

#3 User is offline   Maurizio Domba Cerin 

  • Yii - Yesss It Is !!!
  • Yii
  • Group: Yii Dev Team
  • Posts: 4,340
  • Joined: 12-October 09
  • Location:Croatia

Posted 02 August 2012 - 04:37 AM

This not really related to Yii but to MySql... So did you check the MySql syntax ?

spoiler: for varchar you need to set the length
Find more about me.... btw. Do you know your WAN IP?
1

#4 User is offline   maher 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 69
  • Joined: 31-July 12
  • Location:Edmonton

Posted 02 August 2012 - 04:47 AM

Actually i tried with other data types, but it's also the same.
I even tried to drop the table and created again, and it didn't worked, so I had to restart phpmyadmin, and now everything is fine.

thank you for your quick reply
0

#5 User is offline   rootbear 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 222
  • Joined: 17-June 11

Posted 02 August 2012 - 08:40 AM

for MySQL:

ALTER TABLE `user` 
ADD COLUMN `picture` VARCHAR(255) NOT NULL 
AFTER `dob`; 

I enjoy the Yii.sy coding life here.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users