Kian Posted October 4, 2012 Share Posted October 4, 2012 (edited) Hi Let's talk about SQL syntax. We have this query... $table_hosting = "tblhosting"; $fields_hosting = "packageid,server"; $where_hosting = array("userid"=>$return_orders['userid'],"domainstatus"=>"Active"); $result_hosting = select_query($table_hosting,$fields_hosting,$where_hosting); $return_hosting = mysql_fetch_array($result_hosting); What if i'd want to add an OR operator in the WHERE statement? To make it more clear i translate it with a standard MySQL syntax... SELECT packageid, server FROM tblhosting WHERE userid=$return_orders['userid'] AND domainstatus="Active" OR paymentmethod="paypal" (?) This is my 1st question Now let's go on with a more "complicated" query. What if i'd want to add the OR/AND in a "IN"? Here's the example with the standard MySQL syntax... SELECT packageid, server FROM tblhosting WHERE $return_orders['userid'] IN (userid) AND domainstatus="Active" OR domainstatus="Suspended" (?) This is my 2nd question I hope that someone can explain me because i'm tired to filter queries with php instead of make them ready-to-use and of mixing WHMCS-SQL syntax with MySQL one in the same code. Edited October 4, 2012 by Kian 0 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.