Why is MySQL Database working on my localhost but not on cpanel?

My website URL is: http://www.oglasi-po.ml/index.php

This is my index.php and when i open index than it says “fail man”. I have set my hostname to something like sqlXXX.epizy.com, my username to epiz_XXXXXXXX and my password (the one that cpanel created automatically for me) and my database is something like epiz_XXXXXXXX_oglas

i have defined those in a conf.php and i do not want to upload them here :stuck_out_tongue :stuck_out_tongue:

`				$adCounter = 0;
			
			require_once ('conf.php');
			 
			$sql = "SELECT * MYSQL_DATENBANK ORDER BY date DESC LIMIT 30";
			 
			$db_erg = mysqli_query( $db_link, $sql );
			if ( ! $db_erg )
			{
			  die('Fail man: ' . mysqli_error());
			}
			
			echo "<br>";
			echo "<br>";
			
			while ($zeile = mysqli_fetch_array( $db_erg))
			{

				echo '<span style="color:ORANGE; font-size:18px;">';
					echo "<td>". $zeile['date'];
				echo '</span>';
				echo '<span style="color:orange; font-size:;">';
					echo' (Godina-Mesec-Dan)';
				echo '</span>';
				echo "<br>";
				
				echo '<strong>';
					echo "<td>". $zeile['title'] . ": ";
				echo '</strong>';
				
				echo "<td>". $zeile['text'] . " --> ";
				echo "<td>Tel. ". $zeile['number'] . "";
				echo "</tr>";
				
				echo "<br>";
				echo "<br>";
				
				$adCounter = $adCounter+1;
				
				if($adCounter > 10){
					echo '<div class="adsDiv"></div>';
					echo '<div class="adsDiv"></div>'; 
				}
			}
			echo "</table>";
			 
			mysqli_free_result( $db_erg );
			mysqli_close($db_link);

`

Additional information:
i really do not know what to do here anymore. Anyone has an Idea or guess?
Thanks in advance

For me it works and connects to your database just fine, for you it’s some kind of DNS Propagation or cache problem, so try to clear the cache or use 1.1.1.1 or Quad9 as DNS on your computer

Does it say “fail man” and then something else or not? Because, looking at the code, it should say "Fail man: ", and then the actual error message of the database connection. Could you share that actual error message?

Also, if you haven’t done so yet, you may want to check that error message against the ones covered in this article:

https://infinityfree.net/support/common-mysql-errors/

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