tiiberius Posted November 25, 2016 Share Posted November 25, 2016 Hello, How do you make a proper database query call? What I need is to query the database to grab the tblinvoiceitems line item description and pass this into the line mentioned below as value field (X). $code.='<input type="hidden" name="item_name" value="X"> How do I call the database and retrieve the tblinvoiceitems, then insert it correctly into value="" field? Thank you in advance. 0 Quote Link to comment Share on other sites More sharing options...
tiiberius Posted November 27, 2016 Author Share Posted November 27, 2016 Anyone?... 0 Quote Link to comment Share on other sites More sharing options...
ducohosting Posted November 28, 2016 Share Posted November 28, 2016 Hi! This depends on where you're accessing the database from. If you're accessing it from inside a WHMCS module (addon, gateway, registrar, etc.), you can use the Laravel query builder. The following code should get all the items in tblinvoiceitems for a certain item: use Illuminate\Database\Capsule\Manager as Capsule;$item = Capsule::table('tblinvoiceitems')->where('id', 1)->first(); Have a look here for further documentation about the Laravel query builder. If you're trying to access it from anywhere outside WHMCS, I'd recommend having a look at PDO. 0 Quote Link to comment Share on other sites More sharing options...
tiiberius Posted November 29, 2016 Author Share Posted November 29, 2016 Thank you for your response ducohosting. Yes, it is within WHMCS. More specifically PayPal gateway module (paypal.php) I understand the code you provided will be used as a hook correct? How do I actually make the result of the query appear in the paypal.php? Like I wrote I need it to show in the value field (X) in the following code: $code.='<input type="hidden" name="item_name" value="X"> Thank you in advance. Hi! This depends on where you're accessing the database from. If you're accessing it from inside a WHMCS module (addon, gateway, registrar, etc.), you can use the Laravel query builder. The following code should get all the items in tblinvoiceitems for a certain item: Have a look here for further documentation about the Laravel query builder. If you're trying to access it from anywhere outside WHMCS, I'd recommend having a look at PDO. 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.