Jump to content

[SOLVED] Help with LIKE %


Riparian

Recommended Posts

Is there a way I can limit the % wildcard to only one character

 

e.g.

$stock_number=100a

 

Select all where stock_number like $stock_number%

 

will also return stock number 1000a where all i want is 100a, 100b, 100c etc

 

Any help is really appreciated

 

Link to comment
Share on other sites

Thank you very much for the reply Mchl

 

Could you possibly give me an example where i could match the last digit to any alpha (not number)

 

I have been trying all afternoon using _ and things like REGEXP '^$model.{1}$' but I cant get the desired results.

 

Cheers

Link to comment
Share on other sites

Sorry ... Mistakenly added a $ to the Model_number field in the first reply

 

Thanks for the help.

 

I have tried every combination and only get Parse errors.

 

Could you please advise me where this is going wrong

 

$sql="select * from $table  WHERE model_number RLIKE '$model_number[[a-z]]' and in_stock='T' ";

Link to comment
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.