Tpick Posted October 29, 2021 Share Posted October 29, 2021 Hi, sorry for noob question, first time poster. Hopefully I"m in the correct section of the forum. I'm running php version 5.6.40 and have mysqli enabled on my website. I'm trying to to change over from the old mysql_connect to mysqli_connect (and so on) so that I can eventually upgrade to php 7. I'm wondering if there is anything I'm missing or supposed to do, every resource I can find online says that for something this simple I simply need to add the "i" to the end, but for some reason it won't connect once I add the "i". I'll include the code in question. If I simply delete the "i" it works just fine. $host = "localhost:3036"; $serverusername = "my_username"; $serverpassword = "my_password"; $db_name = "my_db_name"; $connection = mysqli_connect("$host", "$serverusername", "$serverpassword")or die("cannot connect"); $db = mysqli_select_db("$db_name", $connection)or die("cannot select DB"); Quote Link to comment https://forums.phpfreaks.com/topic/314143-changing-from-mysql-to-mysqli-but-it-wont-connect/ Share on other sites More sharing options...
benanamen Posted October 29, 2021 Share Posted October 29, 2021 22 minutes ago, Tpick said: every resource I can find online says that for something this simple I simply need to add the "i" to the end "Every resource" is wrong. Try reading the free manual. This is too simple to just give you the answer.https://www.php.net/manual/en/mysqli.quickstart.connections.phphttps://www.php.net/manual/en/mysqli.select-db.php Quote Link to comment https://forums.phpfreaks.com/topic/314143-changing-from-mysql-to-mysqli-but-it-wont-connect/#findComment-1591573 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.