F
F
freeman02042016-10-04 18:15:43
PHP
freeman0204, 2016-10-04 18:15:43

A modern version of connecting to the database of bathhouses (php)?

I saw these options:

<?php
function cont_load()
{
$loading= mysqli_connect('localhost', 'root', '', 'user_site');
$result= mysqli_query($loading, "SELECT content FROM `posting` WHERE id=1");
while ($a= mysqli_fetch_array($result)) {
        echo $a['content'] . "<br />";
}
mysqli_close($loading);
}
?>

<?php
  //Константы для соединения с базой данных
  define('HOST', 'localhost'); //путь к серверу базы данных
  define('USER', 'root');
  define('PASSWORD', '');
  define('DB', 'minicms');
?>

Which option is best, and is it possible to use only one of the methods and not waste time studying other methods in detail?
Maybe there are other options not listed here by me?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Aksentiev, 2016-10-04
@freeman0204

www.phptherightway.com/#databases

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question