Jump to content

Basic MySQL question from a begginer.


Havharo
Go to solution Solved by Barand,

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



 

Link to comment
Share on other sites

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.