Total noob. Hit problem in Sitepoint book

Just starting with php and have MAMP installed on my Mac. I’m using this Sitepoint book:

I’m following the exercise where you create your first table via the terminal. Ive followed the instructions exactly and everything is fine until I type this into terminal:

CREATE TABLE joke (
-> id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
-> joketext TEXT,
-> jokedate DATE NOT NULL
-> ) DEFAULT CHARACTER SET utf8;

…which is taken from the exercise in the book.

Unfortunately, I get this error:

ERROR 1064 (42000): 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 ‘-> id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
-> joketext TEXT,
-> joke’ at line 2

why? I really am completely new to this so please try to dumb down your answers a bit!

Thanks :slight_smile:

Make sure you aren’t actually typing the “->” as that is just meant to continue typing on the next line. (i.e. they could have put the whole command of the create table statement on one line in the book but it won’t fit, so they break it up but the -> indicates it is part of the same command.) The error suggests that is what you are doing incorrectly.

Hi

I never actually typed those in anyway…tjose are just the symbols that appear when I press return after each line.

No matter anyway…I just quit then restarted MAMP, and typed it in again and now it work!

Thanks for your help anyway :slight_smile: