SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast murphaloid's Avatar
    Join Date
    Oct 2011
    Posts
    54
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Total noob. Hit problem in Sitepoint book

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

    http://www.sitepoint.com/books/phpmy...rect=phpmysql1

    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

  2. #2
    SitePoint Wizard guelphdad's Avatar
    Join Date
    Oct 2003
    Location
    St. Catharines, ON Canada
    Posts
    1,706
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  3. #3
    SitePoint Enthusiast murphaloid's Avatar
    Join Date
    Oct 2011
    Posts
    54
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    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


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •