php - MySQLi BETWEEN query to get data from text fileds in database -


i have query :

$sql = "select * table  concat(prod, serial) between '$start' , '$end'"; 

where prod , serial stored in mysqli database string. need update details of items between aa1000 , aa1005. when run query updates details of units between aa1000 , aa1005 and, "as bonus", between aa10000 , aa10050. there way exact match text type fields using between query?

thanks!

p.s. know need update query update details. i'm using select testing purposes.

this query should it:

select * table prod = left('$start', 2) , cast(serial decimal) between substring('$start', 3) , substring('$end', 3); 

you split start , end strings apart in php:

$prod = substr($start, 0, 2); $start_code = substr($start, 2); $end_code = substr($end, 2);  $sql = "select * table prod = '$prod' , cast(serial decimal) between $start_code , $end_code"; 

Comments