1

This is the program for fine payments. what i would like to know is how do i compare the mobile number in mysql database with the mobile number i want to input import mysql.connector

        database='UAEFINESSYSTEM')
        mycursor=mydb.cursor()
        print("            PAYMENT INFORMATION            ")
        Name=input("FULLNAME:")
        Modeofpayment=input("MODE OF PAYMENT:")
        Cardnumber=int(input("CARD NUMBER:"))
        Mobileno=input("Enter your mobileno")the mobileno i want
        sql="UPDATE CUSTFINES SET FINE=0 WHERE MOBILENO='"+Mobileno+")"
        mycursor.execute(sql)
        print("record updated")
        mydb.commit()
    except Exception as e:
        print(e)
O. Jones
  • 103,626
  • 17
  • 118
  • 172
  • Welcome to Stack Overflow. Comparing telephone numbers is hard. Read this, and weep. https://github.com/google/libphonenumber/blob/master/FALSEHOODS.md – O. Jones Aug 13 '20 at 13:24

1 Answers1

0

Phone numbers make a bad unique identifier for a user We have a lot of choices for punctuating phone numbers. For example, in North America these all refer to the same endpoint.

(212) 555-1212
212 555 1212
+1.212.555.1212   (1 is the country code for North America)
212-555-1212
2125551212
555-1212  (if it's a local call to the same area code, in some areas)

Generally speaking, if you gather a phone number from a user you should display it back to the user the same way they entered it. So, if you want to detect when two phone numbers are the same you can try stripping out the punctuation, and storing the number twice -- once for display (with the user-furnished punctuation) and again without (for matching). You'll still run into trouble with users who sometimes give the country code and other times do not.

This is all easier if your service tests the phone number (by sending it a text, maybe) before storing it permanently. Then you know you have a valid number.

Phone numbers are not numbers. They are text strings. Don't store them as integers or doubles, or you will be sorry. In a table, a VARCHAR(63) column should be plenty.

O. Jones
  • 103,626
  • 17
  • 118
  • 172