PHP FIX IssuesCategory: PHPcannot connect function to database mysqli
phpmaster asked 48 years ago

having lots of issue to connect function to mysqli database  if you can hep me i will be great full to you . Please help me 

1 Answers
phpfix answered 7 years ago

you can try this solution

function getConnected($host,$user,$pass,$db) {

   $mysqli = new mysqli($host, $user, $pass, $db);

   if($mysqli->connect_error) 
     die('Connect Error (' . mysqli_connect_errno() . ') '. mysqli_connect_error());
return $mysqli; } 

for example

$mysqli = getConnected('localhost','user','password','database');

Author - comments - 0

Copyright © 2014 - Designed by Jolly Themes