Jump to content

[Solved] Problem


Luigi123

Recommended Posts

Hello,

Why am I receiving this error when I try to install a donation website for my community?:

Fatal error: Call to a member function listGroups() on null in /home/luigi123/public_html/donations/index.php on line 113


Also, when I try to login, I receive this error as well.

Unable to open connection to MySQL server.
Link to comment
Share on other sites

The first error is occurring because it may be depended on the MySQL connection variable. If you could open the connection to mysql successfully, it should disappear. Otherwise, if it's not depended on mysql variable then, probably you are calling a function of a class without initializing the class.

Link to comment
Share on other sites

You can open a connection to MySQL by doing:

$db=mysqli_connect($host,$user,$pwd,$db);
Then use the variable to your script.

 

I need to see the code to say anything.

Link to comment
Share on other sites

Take this example:

<?php
$host="localhost";
$user="user_example";
$pwd="password";
$db="user_database";
$con=mysqli_connect($host,$user,$pwd,$db) or die("Couldn't connect to the database: ".mysqli_error($con));
if($q=mysqli_query($con,"SELECT field1, field2 FROM example_table")){
   if(db_num_rows($q) > 0){
      while($r=mysqli_fetch_array($q)){
         echo "Field1 Value: {$r['field1']}";
         echo "<br>";
         echo "Field2 Value: {$r['field1']}";
      }
   } else {
      echo "No rows found: The table seems to be empty.";
   }
} else {
   echo "Unable to query database: ".mysqli_error($con);
}
?>
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...