Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.