i have a form and text box where user can enter amount on the basis of that amount tax rate fetch from mysql.the query below working well but when user input above 50000 , i want tax_rate should be calcuated according to 35%.. ...it givning me empty result,,, how to build query for this? i attache my table file jpg structure

SELECT test.id, test.year, test.status, test.start_income, test.end_income, test.tax_rate
FROM test
WHERE (((test.start_income)>5000) and ((test.end_income)>=5000));

something like this perhaps:

if ($_POST['YOUR FORM FIELD'] > 50000){
//do query
}

does this help you?

something like this perhaps:

if ($_POST['YOUR FORM FIELD'] > 50000){
//do query
}

does this help you?

no i didn't think of that.... but solved it myself...some times happend...
fetching tax_rate frm mysql on the basis of user input amount......

SELECT  tax_rate,
case when 10 >(Select Max(End_Income) from test)
Then 
(Select tax_rate from test where end_income =(select Max(End_Income) from test))
Else 
(Select tax_rate from test where Start_Income<=10 And End_Income>10)
end tax_rate
FROM test limit 1
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.