I want to search number in my MySQL data. String is +310623212542 but the mysql row data is only 0623212542. How can i compare ? Please help i am new to the mysql
Asked
Active
Viewed 103 times
-3
-
possible duplicate of [Search for string within text column in MySQL](http://stackoverflow.com/questions/2526772/search-for-string-within-text-column-in-mysql) – Sal00m Jul 11 '14 at 13:13
-
1use `SELECT * FROM tbl WHERE search = SUBSTRING('+310623212542' FROM 4)` – Tamil Selvan C Jul 11 '14 at 13:24
-
in php ` – Tamil Selvan C Jul 11 '14 at 13:30
1 Answers
0
Use
In php
<?php
$search_text = substr('+310623212542',3);
mysqli_query("SELECT * FROM tbl WHERE search LIKE '%$search_text%'");
?>
or
in mysql
use SUBSTRING
SELECT * FROM tbl WHERE search = SUBSTRING('+310623212542' FROM 4)
Note: using substring in mysql impact performance issue, when large data present

Tamil Selvan C
- 19,913
- 12
- 49
- 70