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 Link to comment https://forums.phpfreaks.com/topic/286004-basic-mysql-question-from-a-begginer/ Share on other sites More sharing options...
Barand Posted February 6, 2014 Share Posted February 6, 2014 Have you entered a semicolon ( ; ) to terminate the query statement? 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) 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 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) 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? 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? 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 " 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 Your column names are enclose in single quotes in that last post and in backticks (correct) in your earlier one. Which is it? 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 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
Archived
This topic is now archived and is closed to further replies.