SametALMDR Posted April 28, 2019 Share Posted April 28, 2019 (edited) hi everyone , I am trying to make an query to database with using SQL helper functions ,but ı want to get data from tblclients table using x data column or y .How can I write it in where part using the below code. $table = "tblclients"; $fields = "id,firstname,lastname"; $where = array("x"=>"anything","y"=>"anything"); // This part that ı want to do x or y is equal to anything $result = select_query($table,$fields,$where); while ($data = mysql_fetch_array($result)) { echo $data['id'].$data['firstname']; } Edited April 28, 2019 by WHMCS ChrisD Placed SQL Code into a code box 0 Quote Link to comment Share on other sites More sharing options...
SametALMDR Posted April 28, 2019 Author Share Posted April 28, 2019 also ı get the example from this link : https://docs.whmcs.com/index.php?title=SQL_Helper_Functions&redirect=no 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted April 29, 2019 Share Posted April 29, 2019 20 hours ago, SametALMDR said: also ı get the example from this link did you read the first line on that page about this feature being deprecated ? in other words, it's outdated - use capsule. https://developers.whmcs.com/advanced/db-interaction/ use WHMCS\Database\Capsule; $brian = Capsule::table('tblclients')->select('id','firstname','lastname')->where('fistname','Brian')->get(); that would give you an array $brian of clients whose first name is "Brian"... which you could then loop through if you wanted to modify it, return it to the template as is or whatever... there are lots of examples of similar queries posted in threads here or you can read the documentation about querying... https://laravel.com/docs/5.4/queries 0 Quote Link to comment Share on other sites More sharing options...
SametALMDR Posted May 1, 2019 Author Share Posted May 1, 2019 Thank you Brian.Actually I did not read the part that you said 🙂 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.