php

Mysqli Query PHP

Mysqli Query

This Is A Secure Way To Use mysqli::query .


<?php
function secured_query($sql)
{
$connection = new mysqli($host,$username,$password,$name);

if ($connection->connect_error)
die("Secured");

$result=$connection->query($sql);
if($result==FALSE)
die("Secured");

$connection->close();
return $result;
}
/*
$host ---> DataBase IP Address
$username ---> DataBase Username
$password ---> DataBase Password
$name ---> DataBase Name
*/
?>