I created an account and copied all database information but it doesn't connect

Username (e.g. epiz_30428149) or Website URL

(please specify the website or account you are asking about)

Error Message

The problem is that when I test one of my pages it doesn’t connect to the database at all, although I exactly copied the database username, host, password and name while checking multiple times if I did this correctly.

Other Information

I can’t give a lot of details of course due to security and not sharing the database login details.

  1. Did you use the credentials under “MySQL Details”?

  2. Please share any error messages

  3. Please share your code, but replace your password with “*****”

Thanks

2 Likes
  1. Did you move from localhost to IF?
  2. Mind sharing your code? Make sure to hide your credentials.
  3. Did you use the new credentials from the control panel?
  1. Yes

  2. That is the strange thing, I don’t get any error messages, even if I add that PHP should display mysqli error messages to the code.

I will share the relevant parts:

index.php:

The header contains:

<?php include("./include.php"); ?>

In the body it contains:

<?php $query_stringcount = "SELECT * FROM search_engine"; mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT); $conn1 = mysqli_connect(DB_SERVER, DB_USER, DB_PASS, DB_NAME); $query1 = mysqli_query($conn1, $query_stringcount); $result_count = mysqli_num_rows($query1); echo $result_count ?>

The include.php file contains:

<?php define("DB_SERVER", "sql***.epizy.com"); define("DB_USER", "epiz_30428149"); define("DB_PASS", "*******"); define("DB_NAME", "epiz_30428149_users"); ?>

The *** are the password and the numbers in the host name.

I created a database called “users” and as I understand this should be how you connect to it. The users database contains a table “search_engine” with a table of the links for the search engine.

Is this enough information?

Yes, see my reply to Greenreader9 for the relevant parts of the code.

So what exactly do you see that makes you say that this is a database connection issue? How do you know it’s the database connection when there is no error message?

That is what is confusing me. I have this exact same code and website on another web host provider as well and there it works flawless, so it must be something with the database connection. Do you need to set some kind of PHP ini file?

I’m sorry, but I don’t agree with your logic. There are many reasons why a web page interacting with a database is not returning the right results. Even if the same code is working on another provider.

Especially since your code should report errors if the queries or connection fails fail, which it doesn’t do. So that proves that it’s not the database connection.

I checked your account to see if I could try the page for myself. So I found your search engine page, looked through the database, and I searched for “rayman”. And I did get multiple results for that query.

So as far as I can see, your database connection is working fine.

What do you see that makes you say differently?

2 Likes

Sorry, before you saw that it worked I was trying to fix it and found a fix. I couldn’t reply though because I hit a “16 replies per day” limit on this forum so it was impossible for me to reply to you or on this post that I had solved the problem. What I wanted to post was:

"I solved it! I had misunderstood using the panel password, I thought it was ment to use my own password (of account), but I had to copy the password which was hidden under the account details!

So it’s resolved. :)"

So basically this post can be closed.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.