Convert text into number in MySQL query using php.when input type is set in mysql text then the enter numbers are used as string and these number are not sorted prorperly .
now we are conver this field into interger in mysql query with php.
<?php
// mysql query that change integer
$rs=mysql_query("select * from table order by price CONVERT(SUBSTRING(price,6),SIGNED INTEGER) asc");
// this will fetch correct data in ascending order
?>
if you like this please comment.
now we are conver this field into interger in mysql query with php.
<?php
// mysql query that change integer
$rs=mysql_query("select * from table order by price CONVERT(SUBSTRING(price,6),SIGNED INTEGER) asc");
// this will fetch correct data in ascending order
?>
if you like this please comment.
No comments:
Post a Comment