ChrisTERiS Posted April 28, 2017 Share Posted April 28, 2017 (edited) Hello all, Can someone help me to find which variable holds the database connection to use it in mysqli queries? Or do I need to create a new database connection using data from configuration.php file? Have some scrirpts ready using mysqli, Smarty templates and Bootstrap, and I want to avoid big changes by using PDO. eg in my Forum script I'm using: $sql_forum = mysqli_query($db,"SELECT * FROM " . TABLE_PREFIX . "forums WHERE id=$forumid ORDER BY id ASC LIMIT 1"); Thank you Edited April 28, 2017 by ChrisTERiS 0 Quote Link to comment Share on other sites More sharing options...
ChrisTERiS Posted April 28, 2017 Author Share Posted April 28, 2017 Finally I added a connection and I used my own variable. require __DIR__ . '/init.php'; // Connect to Database $db = mysqli_connect($db_host, $db_username, $db_password, $db_name); if (mysqli_connect_errno()) { echo "Failed to connect to Database: " . mysqli_connect_error(); } 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted April 29, 2017 Share Posted April 29, 2017 if these are for use in hooks, I wouldn't have thought you'd need to use your db details... https://developers.whmcs.com/advanced/db-interaction/ 0 Quote Link to comment Share on other sites More sharing options...
ChrisTERiS Posted April 29, 2017 Author Share Posted April 29, 2017 if these are for use in hooks, I wouldn't have thought you'd need to use your db details... https://developers.whmcs.com/advanced/db-interaction/ Thank you. No, I don't plan to use it in hooks. In simple pages like: https://www.cmsbulletin.com/whmcs/forum.php PDO with transaction (and rollback) are something that I was using back to 1987 with Clipper 5 for Dos. The only that I remember now is the meaning After 10 years that I came back to WHMCS coding, what I can say is that things became much better, but I'm missing the easy of use of vBulletin database manager. Just $db->query_read, $db->query_write etc etc and you can do anything in any place you want. Maybe vB is on EOL, but some things remain without competition. Again thank you ! 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.