MyBB Community Forums
[Error Message] Minecraft Avatar - Printable Version

+- MyBB Community Forums (
+-- Forum: 1.8 Support (
+--- Forum: General Support (
+--- Thread: [Error Message] Minecraft Avatar (/thread-165637.html)

Minecraft Avatar - LonelyAlphaWolf - 2015-01-15

I am having problem with some code I found and wondered if anyone could help me get the code working. I had it working on test website on my computer but when I moved it to the hosted website (Yes I changed the MySQL info) When you try and enter the name it will put up with the error. I have check the MySQL info over and couldn't find anything wrong. Can you help?

Fatal error: Call to undefined function mysqli_connect() in /home/rejectedmc/public_html/changeavatar.php on line 16

$mysqlhost = "";
$mysqluser = "";
$mysqlpass = "";
$mysqldb = "";

$SA = $_POST['setavatar'];

if (mysqli_connect_errno()) {
    throw new Exception(mysqli_connect_error(), mysqli_connect_errno());

$img = "avatar.php?user=".$SA;
mysqli_query($avatarcon,"UPDATE mybb_users SET avatar='$img' WHERE username='$FUTC'");
echo 'Redirecting To Home Page<br>';
echo '<br>Image: <a href='.$img.'><img src='.$img.'></img></a>';


echo '<meta http-equiv="refresh" content="0; url=usercp.php" />';


RE: Minecraft Avatar - UnfedZombie - 2015-02-21

Fatal error: Call to undefined function mysqli_connect() in /home/rejectedmc/public_html/changeavatar.php on line 16

Thats caused because the mysql code in the second code that you provided was either incorrect or wasnt even defined its very important it is used to host and grab info (Mostly to host doe) of avatars from into the avatar database of mybb. make sure you use your mybb db for $mysqldb = "";

You can find all the mysql info in cpanel > mysql databases. Add a user if there isnt one for the mybb database. then use the info you made in the code.
If you correctly did this it shouldnt show any errors and continue.