Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Feb 2007
    Posts
    217
    Thanks
    25
    Thanked 1 Time in 1 Post

    mysqli_error() expects parameter 1 to be mysqli, null given

    I've been looking for hours for a solution for my problem. I simply want to add a record to a database table, but I'm getting the error:

    Code:
    Warning: mysqli_error() expects parameter 1 to be mysqli, null given in /home/a3332410/public_html/process.php on line 164
    Line 164 is the mysqli_query line. Can someone tell me how I can make this work?


    PHP Code:
    $con=mysqli_connect($db_host$db_gebruikersnaam$db_wachtwoord$db_database);
    if (
    mysqli_connect_errno($con)){echo "Failed to connect: " mysqli_connect_error();}

    $query="INSERT INTO contributions (group, subgroup) VALUES ('hoixxx', 'lol')";
    //echo $query;


    mysqli_query($con,$query) or die(mysqli_error($mysqli));

    mysqli_close($con); 
    Ps: mysqli is supported by my host.

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    There is no variable defined for $mysqli. That should be $con in the mysqli_error call.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

  • Users who have thanked Fou-Lu for this post:

    docock (04-25-2013)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •