PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, January 20, 2022

[FIXED] Check string numbers

 January 20, 2022     database, mysql, numbers, phpmyadmin     No comments   

Issue

I have a table in mysql which contains customers names and phone numbers and I want to select customers whose phone number contains only digits because some customer's phone number is wrong and contains special characters and letters.


Solution

Let say your table is called customer, with column phone, this query below returns rows where phone is numbers only.

SELECT * FROM customer WHERE phone REGEXP '^[0-9]+$';


Answered By - Shuwn Yuan Tee
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing