Results 1 to 6 of 6
  1. #1
    Join Date
    Sep 2006
    Posts
    3

    Unanswered: Noob... "Insert Data To MySQL"

    Trying to fallow this tutorial to learn mysql...

    http://www.php-mysql-tutorial.com/my...data-mysql.php

    Ran into a snag...

    Running this command from terminal....

    Macintosh:~ ryanmooney$ mysql < /insert.txt
    ERROR 1064 (42000) at line 1: 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 'Bird
    Fish
    Turtle' at line 1
    Insert text is just a plain textfile with 3 lines of text each proceded by a tab (i have tried without the tab too)...

    insert.txt: >>>
    Bird
    Fish
    Turtle

  2. #2
    Join Date
    Apr 2006
    Location
    Denver, Co. USA
    Posts
    242
    The text file must contain valid sql statements. The three lines - Bird, Fish, Turtle are not sql statements and have no meaning to mysql. If your file contains something like the following, it should work -
    Code:
    INSERT INTO species (name) values ('Bird');
    INSERT INTO species (name) values ('Fish');
    INSERT INTO species (name) values ('Turtle');

  3. #3
    Join Date
    Sep 2006
    Posts
    3
    Thanks,

    Got it...

    I have seen allot of errors in that tutorial already...

    Like
    INSERT INTO species (name) values ('Turtle');
    Should really be
    INSERT INTO species (species) values ('Turtle');
    By means of
    mysql> CREATE TABLE species (id INT NOT NULL AUTO_INCREMENT, species varchar(30) NOT NULL, primary key(id));
    Query OK, 0 rows affected (0.02 sec)
    Yes/No...

    Any way got to learn the bassics somewhere and what better way than from error and trial and error and.... Anyway...

    Thanks for the direction... =]

  4. #4
    Join Date
    Apr 2006
    Location
    Denver, Co. USA
    Posts
    242
    The least error prone version of the information on that web site is available in the mysql documentation. Here is a link to the Tutorial in the manual - http://dev.mysql.com/doc/refman/5.0/en/tutorial.html Section 3.3 and 3.6 are the most useful.

    I recommend downloading a version of the manual for reference - http://dev.mysql.com/doc/ I personally use the Windows CHM version. The "INDEX" tab makes finding information fairly easy.

  5. #5
    Join Date
    Sep 2006
    Location
    USA
    Posts
    1
    It is really??

  6. #6
    Join Date
    Sep 2006
    Posts
    3
    It is really??
    Is it really what... ??

    If you are referring to weather it is the "least error prone" i would say YES i have been flowing the section 3 tutorial and have run in to no hiccups here on mac os x using the command line terminal...

    With the exception of "LOAD DATA LOCAL INFILE" not working on my apache web server if you continue to read and fallow the link about "Security Issues with LOAD DATA LOCAL" i found that i do not use LOCAL with apache...

    Definitely a good reference material with a good easy to use and understand structure and the user comment section is invaluable and should be used by more reference/tutorial sites because if one person has an answer to something most likely there are many others that will benefit from user input...

    Welcoming myself to the world of MySQL could not be easier...

    Thanks "dbmab"... =]

Posting Permissions

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