groups

Link to this snippet:


Download to Code Collector

language: PHP
licence: Other

PHP/MYSQL : usage procedurale de mysqli

options: send to code collectorview all pierre alexandre payet's snippets
$host = "";
$usr = "";
$psswd = "";
$db = "";
$char = "UTF-8"

/* hot to connect to the database */
$link = mysqli_connect($host, $usr, $pass);

/* how to set the default charset to use for this connection */
mysqli_set_charset($link, $char);

/* how to select the database */
mysqli_select_db($link, $db);

/* how to get data in an array with a basic query */
$sql = "select * from 'table'";
$query = mysqli_query($link, $sql);
$result = mysqli_fetch_array($query); //pas besoin de l'objet link pour la recuperation du resultat

/* how to close connection */
mysqli_close($link);