Havharo Posted February 6, 2014 Share Posted February 6, 2014 Hi everyone, This is my first post, so please forgive me if this question showed up earlier. I'm a beginner when it comes to PHP.I have a very basic question. When creating a database through the mysql console, I'm in a moment where I'm done typing all the necessary information for my table and I have a problem with exiting to a new command line.Basically when I press shift + enter I'm in a new line, but not in a command line.I'm sorry for asking so basic question, but this is really frustrating and I cant find answer on my question online. Thank you kindly in advance for the help Regards Quote Link to comment https://forums.phpfreaks.com/topic/286004-basic-mysql-question-from-a-begginer/ Share on other sites More sharing options...
Solution Barand Posted February 6, 2014 Solution Share Posted February 6, 2014 (edited) Have you entered a semicolon ( ; ) to terminate the query statement? Edited February 6, 2014 by Barand Quote Link to comment https://forums.phpfreaks.com/topic/286004-basic-mysql-question-from-a-begginer/#findComment-1467993 Share on other sites More sharing options...
Havharo Posted February 6, 2014 Author Share Posted February 6, 2014 You have my humble thanks, that was it (facepalm) Quote Link to comment https://forums.phpfreaks.com/topic/286004-basic-mysql-question-from-a-begginer/#findComment-1467995 Share on other sites More sharing options...
Havharo Posted February 7, 2014 Author Share Posted February 7, 2014 Hello again , actually today I was trying to create a database with the following code:CREATE TABLE `test`.`users` (`id` INT NOT NULL auto_increment ,`name` VARCHAR( 20 ) NOT NULL ,`password` VARCHAR( 20 ) NOT NULL ,`email` VARCHAR( 20 ) NOT NULL ,PRIMARY KEY ( `id` )) (I've got it from this website: http://forum.codecall.net/topic/44787-creating-loginregistration-forms-with-php/ ) When I'm typing the semicolon ( ; ) after the last parenthesis, console is taking me to a new line.Yesterday I've checked it only on one line of code, and it worked. Today when I came back to the exercise, I'm still having the problem. Could You please answer what I'm doing wrong? Thank you kindly in advance Quote Link to comment https://forums.phpfreaks.com/topic/286004-basic-mysql-question-from-a-begginer/#findComment-1468113 Share on other sites More sharing options...
Barand Posted February 7, 2014 Share Posted February 7, 2014 The query should be executed when you press ENTER after the semicolon EG mysql> use test; Database changed mysql> CREATE TABLE `users` ( -> `id` INT NOT NULL auto_increment , -> `name` VARCHAR( 20 ) NOT NULL , -> `password` VARCHAR( 20 ) NOT NULL , -> `email` VARCHAR( 20 ) NOT NULL , -> PRIMARY KEY ( `id` ) -> ); Query OK, 0 rows affected (0.11 sec) Quote Link to comment https://forums.phpfreaks.com/topic/286004-basic-mysql-question-from-a-begginer/#findComment-1468115 Share on other sites More sharing options...
Havharo Posted February 7, 2014 Author Share Posted February 7, 2014 Hi, thank you for the help. At this moment it works, but I'm getting error 1064(42000). Is it possible that the syntax above is wrong for mySQL ver 5.6.12? Quote Link to comment https://forums.phpfreaks.com/topic/286004-basic-mysql-question-from-a-begginer/#findComment-1468119 Share on other sites More sharing options...
Barand Posted February 7, 2014 Share Posted February 7, 2014 I can't see anything obvious. What was the full error message? Quote Link to comment https://forums.phpfreaks.com/topic/286004-basic-mysql-question-from-a-begginer/#findComment-1468123 Share on other sites More sharing options...
Havharo Posted February 7, 2014 Author Share Posted February 7, 2014 I'm getting the following 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 ' 'users'('id' INT NOT NULL auto_increment ,'name' VARCHAR( 20 ) NOT NULL, 'pas' at line 1 " Quote Link to comment https://forums.phpfreaks.com/topic/286004-basic-mysql-question-from-a-begginer/#findComment-1468126 Share on other sites More sharing options...
Barand Posted February 8, 2014 Share Posted February 8, 2014 (edited) Your column names are enclose in single quotes in that last post and in backticks (correct) in your earlier one. Which is it? Edited February 8, 2014 by Barand Quote Link to comment https://forums.phpfreaks.com/topic/286004-basic-mysql-question-from-a-begginer/#findComment-1468130 Share on other sites More sharing options...
Havharo Posted February 8, 2014 Author Share Posted February 8, 2014 I've used backticks and it's ok now. Thank you kindly for your help Quote Link to comment https://forums.phpfreaks.com/topic/286004-basic-mysql-question-from-a-begginer/#findComment-1468180 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.