Proper mysqli_query and mysqli_error configuration

When launching my code I get a failed query and the following errors:

mysqli_query() expects parameter 1 to be mysqli, null given in

mysqli_error() expects parameter 1 to be mysqli, string given in

<?php
include('mysql_config.php');

function mysqlConnect()
{
    global $mysql_hostname, $mysql_username, $mysql_password, $mysql_database;
    $link = mysqli_connect($mysql_hostname, $mysql_username, $mysql_password) 
    or die('Could not connect: ' . mysqli_error());
    mysqli_select_db($link,$mysql_database) or die('Could not select database');
    return $link;
}

function mysqliClose($link)
{
    mysqli_close($link);
}

function sendQuery($query)
{
    $result = mysqli_query($link, $query) or die('Query failed: ' . mysqli_error("could not query"));
    return $result;
}

?>

How do I properly format the mysqli_query and mysqli_error functions?

Leave a Reply

*

Hire Me
Follow Me!
Search
Most Popular Articles & Pages
Because your vote is Important
Sorry, there are no polls available at the moment.
Categories