Hack Forums
[PHP] Mysqli Connect (Database) - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Web Development (https://hackforums.net/forumdisplay.php?fid=183)
+---- Thread: [PHP] Mysqli Connect (Database) (/showthread.php?tid=5983704)



Mysqli Connect (Database) - Codepacks - Jun 26, 2019

PHP Code

<?php 
$mysqli 
= new mysqli();
$mysqli->connect('Hostname', 'DBusernam', 'DBpassword', 'DBname ');

//Hostname - normaly localhost
//DBusername - your mysql username
//DBpassword - your mysql password
//DBname - your mysql database name


if ($mysqli->connect_errno) { echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error; } 



RE: Mysqli Connect (Database) - SIM-3991524 - Jun 26, 2019

thought we were supposed to use PDO


RE: Mysqli Connect (Database) - biscuit deluxe - Jun 26, 2019

I mean the same thing but with better documentation can be found using Google.


RE: Mysqli Connect (Database) - Oxycodone - Jun 26, 2019

(Jun 26, 2019 03:55 PM)f411en Wrote:  thought we were supposed to use PDO

My opinion, many may disagree. Use whatever you feel comfortable with.

I use PDO, I use to use MySqli .

I find the whole debate on what to use confuses more than helps.