Klass 0 Report post Posted September 5, 2005 I have a form written in html with the input box labeled:AttackBonusI have a query: $query = "Select * From i bf_farmlist Where '%".$AttackBonus."%' >= i bf_farmlist.Defense_Bonus Order By i bf_farmlist.Name Asc"; I have no idea how to get the form variable to the query, as the variable always changes.Here is the form:http://forums.xisto.com/no_longer_exists/ Share this post Link to post Share on other sites
calixt 0 Report post Posted September 5, 2005 I have a form written in html with the input box labeled: AttackBonus I have a query: $query = "Select * From i bf_farmlist Where '%".$AttackBonus."%' >= i bf_farmlist.Defense_Bonus Order By i bf_farmlist.Name Asc"; I have no idea how to get the form variable to the query, as the variable always changes. Here is the form: http://forums.xisto.com/no_longer_exists/ <{POST_SNAPBACK}> Klass,I am not sure but I think you refer to the file http://forums.xisto.com/no_longer_exists/. IMHO in your query the part "$AttackBonus" should be replaced by "$_POST['AttackBonus]". As far as I know, the attribute "enctype='multipart/form-data' " in your <form> tag is not necessary. Share this post Link to post Share on other sites
vujsa 0 Report post Posted September 6, 2005 Klass, I'm pretty bad with MySQL queries but here goes. $query = "SELECT * FROM i bf_farmlist WHERE i bf_farmlist.Defense_Bonus <= '$_POST[AttackBonus]' ORDERED BY i bf_farmlist.Name Asc"; The field name comes first and is compared to the variable. That should help a little. Like I said, I'm not very good at MySQL queries. vujsa Share this post Link to post Share on other sites
vizskywalker 0 Report post Posted September 6, 2005 Since the form goes to a PHP script (where I imagine you perform the SQL query) it is really more of a php question than a database one. However, all you need to do is acces the PHP Post array. you can do this by using it as a variable: $_POST[key] where key is the name of the form element you wish to get a value for. All you have to do is an assignment statement to assign the POST variable to another variable, then simply use that variable inside your query statement. If that doesn't help, showing the code you use, would allow me to better serve your needs. ~Viz Share this post Link to post Share on other sites
Klass 0 Report post Posted September 6, 2005 wow,for some reason there was 2 queries in my search pageso the one I was working with was being over ridden with the other one.thnx for your help. Share this post Link to post Share on other sites
Klass 0 Report post Posted September 6, 2005 trying to add another query: select * From farmlist Where farmlist.Defense_Bonus <= 91000 AND farmlist.Army_Size <> 1000 Order By farmlist.`Time` Desc What I want is the first part of the queryto give me all Defense_Bonus less than or equal too 91000 which is defined by: <= &the second part of the query to give me Army_Size 10 times +/- by 1000not sure how I do the second part of the query. Share this post Link to post Share on other sites
vizskywalker 0 Report post Posted September 7, 2005 10 times +/- by 1000Not quite sure what that means, so I'm not sure how to help, can you describe that using words?~Viz Share this post Link to post Share on other sites
Klass 0 Report post Posted September 7, 2005 in the db there is different entries for Army_Size.say 9000875209450etc.I need the query to do a calculation based on 1000 so 10 times more than 1000 and 10 times less than 10001000 would be my army size so i want to know who is in my 10 times attacking rangefor the first part of the query i have defense bonus in the db5600034000309300etcso by doing defens_bonus <= 91000 it should pull all the rows less than or equal to 91000hope this helps Share this post Link to post Share on other sites