hahaitwork Posted October 23, 2012 Share Posted October 23, 2012 (edited) $get = mysql_query ('SELECT id , name, description, price , shipping FROM products WHERE id < 100 ORDER BY id DESC'); How do I manage to make it like this, so it order from 1-100 ids, and also check if there is quanity's $get = mysql_query ('SELECT id, name, description, price , shipping FROM others WHERE quantity > 0 ORDER BY id DESC'); Both works, but I want them mixed together, so it reads if there is quanity's And from id < 100 - Thanks Edited October 23, 2012 by hahaitwork Quote Link to comment Share on other sites More sharing options...
Maq Posted October 23, 2012 Share Posted October 23, 2012 (edited) You said it right in your post, just add in the condition: WHERE id < 100 AND quantity > 0 ORDER BY id DESC'); Edited October 23, 2012 by Maq Quote Link to comment Share on other sites More sharing options...
White_Lily Posted October 23, 2012 Share Posted October 23, 2012 You answered the question yourself as Maq so correctly stated lol. Quote Link to comment Share on other sites More sharing options...
hahaitwork Posted October 23, 2012 Author Share Posted October 23, 2012 You said it right in your post, just add in the condition: WHERE id < 100 AND quantity > 0 ORDER BY id DESC'); Hehe, thanks.. I hoped it to be something like this, but I didn't know about the "AND" function.. so I tried , etc and that did not work thx ! Quote Link to comment Share on other sites More sharing options...
hahaitwork Posted October 23, 2012 Author Share Posted October 23, 2012 1 more question as well, how do I make so the id will go from 100-200 ? Simple stuff I bet.. WHERE id < 100 AND quantity > 0 ORDER BY id DESC'); Quote Link to comment Share on other sites More sharing options...
White_Lily Posted October 23, 2012 Share Posted October 23, 2012 This may need to be a different query. But... WHERE id >=100 AND id < 200 AND quantity > 0 ORDER BY id DESC'); Quote Link to comment Share on other sites More sharing options...
hahaitwork Posted October 23, 2012 Author Share Posted October 23, 2012 This may need to be a different query. But... WHERE id >=100 AND id < 200 AND quantity > 0 ORDER BY id DESC'); Works pretty well , Thanks 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.