Xephis 5 Newbie Poster

Hi

I am trying to run a query where the user enters a number, and it searches the table for it and displays any results within 50 of that search.
e.g. user searches for 500, anything from 450-550 would be shown.
I have the code for showing an exact result (below, modified as an example) but am unsure how to search for values within 50 points above and below it. Would you use between? If you would, how would you declare it to be 50 above or below?

    <?php

     $Numbersearch= $_POST['Number'];

     $sql = mysql_query("SELECT * FROM tblname WHERE Number LIKE '$Numbersearch'")

     ?>

Thanks for any help, and sorry if this isn't the right section to be posting in.

EDIT: Sorry, I should have tried harder myself, I usually don't post looking for help (as you can guess by my 1 post) because I can usually figure things out myself. I guess I just thought it was harder than it actually was...

Here's how I done it in the end:

     <?php
     $Numbersearchminus= $_POST['Number']-50;
     $Numbersearchplus= $_POST['Number']+50;

     $sql = mysql_query("SELECT * FROM tblname WHERE Number BETWEEN '$Numbersearchminus' AND '$Numbersearchplus'")

     ?>
Biiim commented: helpful +5
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.