+ 2

How to connect mysql in php???

Hey please say me how to connect mysql in php. i know the mysqli method. please someone provide me the simple method... thanks in advance.😀😀

11th Jan 2018, 11:08 AM
musthu cnz
musthu cnz - avatar
2 odpowiedzi
+ 7
Php Ways of connection to database MySql Object oriented: <?php $mysqli = new mysqli("localhost", "username", "password", "dbname"); $result = $mysqli->query("SELECT lastname FROM employees"); ?> PDO : <?php $myPDO = new PDO('mysql:host=localhost;dbname=dbname', 'username', 'password'); $result = $myPDO->query("SELECT lastname FROM employees"); ?> Mysql procedural: <?php mysql_connect('localhost','username','password'); mysql_select_db("dbname"); $result = mysql_query('SELECT lastname FROM employees'); ?>
11th Jan 2018, 11:32 AM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar
+ 4
Thanks Mr. Khan i liked the Mysql procedural
11th Jan 2018, 11:49 AM
musthu cnz
musthu cnz - avatar