MySQL to achieve a simple registration login (Easy language) _ Easy language

Source: Internet
Author: User
Tags port number

Easy Language Introduction:

Easy language is a programming language in Chinese as a program code. Known for its "easy". Founder for Wu Tao. The earlier version of the name is E language. The release of the earliest version of the language can be traced back to September 11, 2000. The original intention of creating an easy language is to practice writing programs in Chinese. From 2000 to now, easy language has been developed to a certain scale, functional, the number of users are very considerable.

Main easy language commands to use:

Connect MySQL (,,,,)

Execute SQL statement (,)

Fetch Recordset ()

Read field values (,,)

Release Recordset ()

Disconnect MySQL ()

Command introduction:

①, Connection MySQL (,,,,): As the name suggests, this command is used to connect to your MySQL database, return a MySQL handle (integer) to indicate a successful connection, return 0 means that the connection failed, a total of 5 parameters.

The first parameter is the MySQL server address, the type is text type, nullable, if empty, the default native;

The second parameter is the MySQL username, the type is text type;

The third parameter is the MySQL password, the type is text type;

The fourth parameter is the database name and the type is text type;

The fifth parameter is the port number, the type is an integer, nullable, and the default 3306 if null.

After the valid MySQL handle is used, the related resources need to be freed by the "disconnect MySQL" command.

②, execute SQL statement (,): Executes a SQL statement, execution returns true successfully, failure returns false. If the execution succeeds, the recordset handle can be obtained through the fetch recordset command. A total of 2 parameters.

The first parameter is a MySQL handle and the type is an integer;

The second parameter is the SQL statement, the type is text type, if do not understand SQL statement, can own Baidu to understand.

③, Fetch recordset (): A collection of records after a query (short name: Recordset). Returns a record set handle. There is a total of one parameter, the MySQL handle, and the type is an integer. This parameter must be the return value obtained by this process calling the "connect MySQL" command. When you are finished using the recordset, you release the recordset by releasing the Recordset command.

④, read field value (,,,): reads the field contents of the current row in the Recordset, and the field index starts at 0. Read successfully returned true, failed to return false. If the read succeeds, the data in the field is written to the result variable. A total of three parameters.

The first parameter is a recordset handle and the type is an integer. This parameter must be the return value obtained by this process calling the Fetch Recordset command.

The second parameter is a field and the type is generic. This parameter specifies the field you want to read, either the field name or the field ordinal.

The third parameter is the result variable, and the type is generic. Only variables are supplied when parameter data is supplied, and this argument is the variable that holds the returned result.

⑤, releasing Recordset (): Once the Recordset is freed, the original Recordset handle is no longer available. There is a parameter, a recordset handle, and the type is an integer. This parameter must be the return value obtained by this process calling the Fetch Recordset command.

⑥, disconnect MySQL (): Disconnect a MySQL connection. The original connection handle is no longer available after disconnecting. There is a total of one parameter, the MySQL handle, and the type is an integer. This parameter must be the return value obtained by this process calling the "connect MySQL" command.

PS: The above is simply introduced, details can be viewed by themselves!

Interface design as shown:

Registration (two tags, two edit boxes, a button, name for the registered user name tag, registered password tag, registered user name edit box, registration password edit box and registration button)

Login (two tags, two edit boxes, a button, name for the login user name tag, login password tag, login username edit box, login password edit box and login button)

PS: The interface is a bit shabby, there is no mailbox, but the code is the same!

Get ready:

Create a new table in the database to store the user's table. The table I built here is named user and has two fields: username and password (the field type is text and the character set is UTF-8), as shown in the figure:

Main code:

Figure 1

Figure 2

Figure 3

Code Commentary:

The code is simpler, as long as you understand SQL and understand the main commands you use.

Summarize:

The main thing in the code is the SQL statement, the primary command is the time. So the operation of the database to understand SQL and will operate some of the commands, that write code is not a thing! I will not be ignorant!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.