Jump to content

[SOLVED] PHP mysql BETWEEN query


Miko

Recommended Posts

Hello,

 

I'm making a script where a user can insert a value of 14 numbers to search a corresponding ID.

This value should be broken down in 2 (first 4 numbers and then 10 numbers).

I've done this with a substr so here no problem.

 

But now I have to query this value with a BETWEEN.

 

my code/query

 

$parcel_depot = substr($searchterm, 0, 4);
				$parcel_number = substr($searchterm, 4, 10);
				$parcel_sql = "SELECT * FROM Number WHERE depot = '$parcel_depot' AND '$parcel_number' BETWEEN 'from' AND 'to'";

 

But seems that it doesn't work.

 

What am I doing wrong here?

 

Thanks :-)

Link to comment
https://forums.phpfreaks.com/topic/156248-solved-php-mysql-between-query/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.