Jump to content

Basic MySQL question from a begginer.


Havharo

Recommended Posts

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

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 :)



 

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)

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 "

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.