Cakephp blog tutorial, SQL error when INSERTING into posts.

2013-08-05 Thread Greg Sarpy
Hi guys, this is my first attempt at CakePHP and so far it seems amazing. 
I'm not a PHP/DB pro but I am learning. 

Anyway, I'm familiarizing myself with the framework by creating the blog in 
the tutorial. So far I've successfully created the table, now I am trying 
to *INSERT INTO POSTS* exactly as it is in the manual:


INSERT INTO posts (title,body,created)
 VALUES ('The title', 'This is the post body.', NOW());
 INSERT INTO posts (title,body,created)
 VALUES ('A title once again', 'And the post body follows.', NOW());
 INSERT INTO posts (title,body,created)
 VALUES ('Title strikes back', 'This is really exciting! Not.', NOW());


It immediately outputs the following error:

Error
 *SQL query:
 *INSERThttps://s97211.gridserver.com/.tools/phpMyAdmin/current/url.php?url=http%3A%2F%2Fdev.mysql.com%2Fdoc%2Frefman%2F5.1%2Fen%2Finsert.htmltoken=dc469536a0bc464e2477613903bf7463
  INTO posts( title, body, created ) 
 VALUES (
 ’The title’, ’This 
 IShttps://s97211.gridserver.com/.tools/phpMyAdmin/current/url.php?url=http%3A%2F%2Fdev.mysql.com%2Fdoc%2Frefman%2F5.1%2Fen%2Fcomparison-operators.html%23operator_istoken=dc469536a0bc464e2477613903bf7463
  the post body.’, 
 NOWhttps://s97211.gridserver.com/.tools/phpMyAdmin/current/url.php?url=http%3A%2F%2Fdev.mysql.com%2Fdoc%2Frefman%2F5.1%2Fen%2Fdate-and-time-functions.html%23function_nowtoken=dc469536a0bc464e2477613903bf7463
 ( )
 );
 *MySQL said: *[image: Documentation]

 https://s97211.gridserver.com/.tools/phpMyAdmin/current/url.php?url=http%3A%2F%2Fdev.mysql.com%2Fdoc%2Frefman%2F5.1%2Fen%2Ferror-messages-server.htmltoken=dc469536a0bc464e2477613903bf7463#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 'title’, 
 ’This is the post body.’, NOW())' at line 2 



I am now stuck because I do not see what's wrong here. While my SQL is 
limited, it looks correct.. can anyone see what could be causing this 
error? 


Here's the database info:

Apache/2.2.22
Database client version: libmysql - 5.1.66


Thank you for any help!!

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Cakephp blog tutorial, SQL error when INSERTING into posts.

2013-08-05 Thread Marcelo F Andrade
On Mon, Aug 5, 2013 at 11:51 AM, Greg Sarpy on.const...@gmail.com wrote:

 (..) I am trying to *INSERT INTO POSTS* exactly as it is in the manual:

 INSERT INTO posts (title,body,created)
 VALUES ('The title', 'This is the post body.', NOW());
 (..)

 It immediately outputs the following error:
 (..)
 MySQL said:
 #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 
 'title’, ’This is the post body.’, NOW())' at line 2

I'm not sure about what is going on.  But I can suppose the
command is using the typographic quotes (“) instead of normal
double quotes () to delim text.

Did you typed the SQL insert in a Mysql client or just copy-
and-paste the command from the cookbook?

Additionally, check if this tip can help.
http://markmcb.com/2011/11/07/replacing-ae%E2%80%9C-ae%E2%84%A2-aeoe-etc-with-utf-8-characters-in-ruby-on-rails/

Regards.

MARCELO F ANDRADE | Belem, Amazonia, Brazil | http://about.me/mfandrade

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.