Skip to content

Instantly share code, notes, and snippets.

@NaokiStark
Last active September 28, 2015 16:20
Show Gist options
  • Save NaokiStark/d465bc980d65de2902d7 to your computer and use it in GitHub Desktop.
Save NaokiStark/d465bc980d65de2902d7 to your computer and use it in GitHub Desktop.
<?php
$host=""; //rellenar
$port=""; //con datos
$user=""; //de conexion
$pass=""; //para
$db=""; //mysqli
if ($port != ""){
$HostFull = $host . ":" . $port;
}
else
{
$HostFull = $host;
}
$connection = @new mysqli($HostFull, $user, $pass, $db);
if($conection->connect_error){
die("Error en la conexion : ".$connection->connect_errno."-".$connection->connect_error);
}
$connection->set_charset("utf-8"); //Para UTF-8
//$connection es la variable de mysqli
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment