phpstuff Posted August 27, 2013 Share Posted August 27, 2013 I entered in the below code into terminal and got the error below in red. Not sure where the error is? I double checked it but operating on minimal sleep so maybe a dumb error... INSERT INTO users (first_name, last_name, email, pass, registration_date) VALUES ('John', 'Lennon', 'john@beatles.com', SHA1('Happin3ss'), NOW()), ('Paul', 'McCartney', 'paul@beatles.com', SHA1('letITbe'), NOW()), ('George', 'Harrison', 'george@beatles.com', SHA1('something'), NOW()), ('Ringo', 'Starr', 'ringo@beatles.com', SHA1('thisboy'), NOW()); 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 'VALUES('John', 'Lennon', 'john@beatles.com', SHA1('Happin3ss'), NOW()),('Paul'' at line 1 Link to comment Share on other sites More sharing options...
Larry Posted August 27, 2013 Share Posted August 27, 2013 That's very strange. I don't see anything obvious there. Could you lay out the steps you took to get to that point (what you did before running that query)? Link to comment Share on other sites More sharing options...
phpstuff Posted August 27, 2013 Author Share Posted August 27, 2013 Sure here is all the code below. There is an error towards the bottom (George Harrison) I did find, but, as you'll see after that I corrected it (it was missing 1 parenthesis on the NOW ). Maybe you can find something. Maybe restart everything?? mysql> use sitename; Database changed mysql> CREATE TABLE users ( -> user_id MEDIUMINT UNSIGNED NOT NULL -> AUTO_INCREMENT, -> first_name VARCHAR(20) NOT NULL, -> last_name VARCHAR(40) NOT NULL, -> email VARCHAR(60) NOT NULL, -> pass CHAR(40) NOT NULL, -> registration_date DATETIME NOT NULL, -> PRIMARY KEY (user_id) -> ); Query OK, 0 rows affected (0.03 sec) mysql> SHOW TABLES; +--------------------+ | Tables_in_sitename | +--------------------+ | users | +--------------------+ 1 row in set (0.00 sec) mysql> SHOW COLUMNS FROM users; +-------------------+-----------------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------------------+-----------------------+------+-----+---------+----------------+ | user_id | mediumint(8) unsigned | NO | PRI | NULL | auto_increment | | first_name | varchar(20) | NO | | NULL | | | last_name | varchar(40) | NO | | NULL | | | email | varchar(60) | NO | | NULL | | | pass | char(40) | NO | | NULL | | | registration_date | datetime | NO | | NULL | | +-------------------+-----------------------+------+-----+---------+----------------+ 6 rows in set (0.01 sec) mysql> INSERT INTO users -> (first_name, last_name, email, pass, registration_date) -> VALUES ('John', 'smith', 'johnsmith@yahoo.com', SHA1('testpassword'), NOW()); Query OK, 1 row affected (0.00 sec) mysql> INSERT INTO users VALUES -> (NULL, 'Zoe', 'Isabella', 'email2@example.com', SHA1('mojito'), NOW()); ERROR 2006 (HY000): MySQL server has gone away No connection. Trying to reconnect... Connection id: 44 Current database: sitename Query OK, 1 row affected (0.00 sec) mysql> INSERT INTO users (first_name, last_name, email, pass, registration_date) VALUES -> ('John', 'Lennon', 'john@beatles.com', SHA1('Happin3ss'), NOW()), -> ('Paul', 'McCartney', 'paul@beatles.com', SHA1('lefITbe'), NOW()), -> ('George', 'Harrison', 'george@beatles.com', SHA1('something'), NOW(), -> ('Ringo', 'Starr', 'ringo@beatles.com', SHA1('thisboy'), NOW()); 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 '' at line 5 mysql> INSERT INTO users (first_name, last_name, email, pass, registration_date) VALUES -> ('John', 'Lennon', 'john@beatles.com', SHA1('Happin3ss'), NOW()), -> ('Paul', 'McCartney', 'paul@beatles.com', SHA1('letITbe'), NOW()), -> ('George', 'Harrison', 'george@beatles.com', SHA1('something'), NOW()), -> ('Ringo', 'Starr', 'ringo@beatles.com', SHA1('thisboy'), NOW()); 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 'VALUES ('John', 'Lennon', 'john@beatles.com', SHA1('Happin3ss'), NOW()), ('Paul'' at line 1 mysql> INSERT INTO users (first_name, last_name, email, pass, registration_date) VALUES ('John', 'Lennon', 'john@beatles.com', SHA1('Happin3ss'), NOW()), ('Paul', 'McCartney', 'paul@beatles.com', SHAe) VALUES ('John', 'Lennon', 'john@beatles.com', SHA1('Happin3ss'), NOW()), ('Paul', 'McCartney', 'paul@beatles.com', SHA1('letITbe'), NOW()), ('George', 'Harrison', 'george@beatles.com', SHA1('something'), NOW()), ('Ringo', 'Starr', 'ringo@beatles.com', SHA1('thisboy'), NOW()); 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 'VALUES ('John', 'Lennon', 'john@beatles.com', SHA1('Happin3ss'), NOW()), ('Paul'' at line 1 Link to comment Share on other sites More sharing options...
StephenM Posted August 27, 2013 Share Posted August 27, 2013 I entered in the below code into terminal and got the error below in red. Not sure where the error is? I double checked it but operating on minimal sleep so maybe a dumb error... INSERT INTO users (first_name, last_name, email, pass, registration_date) VALUES ('John', 'Lennon', 'john@beatles.com', SHA1('Happin3ss'), NOW()), ('Paul', 'McCartney', 'paul@beatles.com', SHA1('letITbe'), NOW()), ('George', 'Harrison', 'george@beatles.com', SHA1('something'), NOW()), ('Ringo', 'Starr', 'ringo@beatles.com', SHA1('thisboy'), NOW()); 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 'VALUES ('John', 'Lennon', 'john@beatles.com', SHA1('Happin3ss'), NOW()), ('Paul'' at line 1 I tested this code and it worked for me without changing your code. So I'm not sure why either. Link to comment Share on other sites More sharing options...
phpstuff Posted August 28, 2013 Author Share Posted August 28, 2013 I've since quit using Terminal and have been using phpmyadmin with no issues. If I have both PMA and Terminal open simultaneously would that screw up anything? Link to comment Share on other sites More sharing options...
Larry Posted August 28, 2013 Share Posted August 28, 2013 It's very strange. I don't see any reason why you'd get that error. phpMyAdmin is fine, and there's no problem with having both open at once. Link to comment Share on other sites More sharing options...
phpstuff Posted August 30, 2013 Author Share Posted August 30, 2013 Sounds good and that makes sense - thanks for your help and reply! Link to comment Share on other sites More sharing options...
Recommended Posts