phpmo Posted April 4, 2008 Share Posted April 4, 2008 $hsel = mysql_query("select id,name,(stata-statb) as nstata,statc,(nstata*2+statc*5-statb*2) as statd from table order by statd desc, id asc limit 100"); Trying to get the formula to work in this query...I"ve never really mess with major formulas so this one is throwing me for a loop. Any help would be appreciated. Quote Link to comment Share on other sites More sharing options...
Barand Posted April 4, 2008 Share Posted April 4, 2008 If there is an error in your formula, how are we supposed to know what the correct formula should be? All you've told us is what it shouldn't be. Quote Link to comment Share on other sites More sharing options...
gluck Posted April 4, 2008 Share Posted April 4, 2008 Post the formula Quote Link to comment Share on other sites More sharing options...
phpmo Posted April 5, 2008 Author Share Posted April 5, 2008 This is what I have above. I'm not getting anything. It's actually coming back as a syntax error. I haven't really fine tuned the formula yet but I need to do it based of fields in a table as I've posted above. All I'm asking is should that work since it's not working now. What am I missing. Quote Link to comment Share on other sites More sharing options...
fenway Posted April 5, 2008 Share Posted April 5, 2008 How about posting the syntax error? Quote Link to comment Share on other sites More sharing options...
phpmo Posted April 7, 2008 Author Share Posted April 7, 2008 PHP Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/******/public_html/test.php on line 3 Quote Link to comment Share on other sites More sharing options...
Barand Posted April 7, 2008 Share Posted April 7, 2008 That is not the syntax error message, that's just a subsequent result of the original error select ... from table ... Put your tablename in place of "table". (And if that is your table name, change it.) Quote Link to comment Share on other sites More sharing options...
phpmo Posted April 7, 2008 Author Share Posted April 7, 2008 What I"m asking is the query correct. I changed the tablename to table simply because I'm anal and don't like the names of all my tables etc on the net. All table names etc are correct but something must be wrong with the way I have the query written using the math calculations. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.