Not Solved [Error Message] Minecraft Avatar
#1
Not Solved
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


<?php 
$mysqlhost = "";
$mysqluser = "";
$mysqlpass = "";
$mysqldb = "";

$FUTC = $_POST['FUTC'];
$SA = $_POST['setavatar'];

$avatarcon=mysqli_connect($mysqlhost,$mysqluser,$mysqlpass,$mysqldb);
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>';

mysqli_close($avatarcon);

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


?>
Reply
#2
Not Solved
This user has been denied support. This user has been denied support.
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 minecraft.net 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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)