The Count result of the MySQL stored procedure is incorrect.

Source: Internet
Author: User

I have been learning PHP for this holiday and will inevitably use the MySQL database. I used the stored procedure and encountered a small problem. I did not solve a lot of problems I found on the Internet. Then I discovered this. Alas, beginners struggle.

Problem:UsernameVarchar (50 ),PassVarchar (500)

 

Declare C int;
Select count (*) into C from user where pass =Pass And username =Username;

Number of all records displayed

Solution:

NameVarchar (50 ),Oldpass Varchar (500)

 

Declare C int;
Select count (*) into C from user where pass =OldpassAnd username =Name;

This is correct !!!

 

Found? Pay attention to the upper and lower green part, the originalMySQL is case insensitive.That is to say, the username and username are the same. Of course, the where condition is always correct. Haha... I hope you will pay attention to it.

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.