From: Eve Atley [mailto:[EMAIL PROTECTED]

> I am attempting to construct a select statement in which I 
> can find values between two fields: start, and end. I have 
> tried using "BETWEEN" and comparing with <= and >=, but 
> neither meet success. Can someone please set me straight? 
> This is meant to be in a PHP page, but I'm assuming the 
> syntax is similar if not the same. I understand there is 
> also a min/max, but I'm not sure it would work in this 
> instance.
> 
> $sql = "SELECT * FROM federal-married WHERE start >= 
> ".$_POST['salary']." AND end <= ".$_POST['salary'];
> 
> --------------------
> Table: federal-married (finds federal tax rate based on 
> marital status)
> start = min field, ie. 804
> end = max field, ie. 2801
> $_POST['salary'] = salary of individual posted from a form


Have you tried this?

$sql = "
        SELECT * 
        FROM federal-married 
        WHERE {$_POST['salary']} BETWEEN start AND end
";


-- 
Mike Johnson
Web Developer
Smarter Living, Inc.
phone (617) 886-5539

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to