Why does my php log in page only work on my device? (noob question)

islandhelpers

New member
I'm a complete beginner and I couldn't find a solution anywhere, I uploaded a mysql database and connected my php site to it, its just a simple log-in page where the username and passwords are stored and retrieved from a mysql database. The website works perfectly fine on my laptop, I tried multiple user-password combinations and they all work and writing it incorrectly doesnt grant access. However, on any other device it, any user-password combination I try, I get the 'incorrect details'. I'm wondering if MySQL databases are only available locally?

I'm using a free web hosting service 0fees.us, I uploaded the database in the cpane's phpMyadmin, I have a db_conn.php in which I run mysqli_connect with the host being sql206.0fees.us, the debugging I've done is inserting new user-password combinations and seeing if they work on my laptop, they do which assures me that the database is connected, however they still don't work on other devices

this is how my db_conn.php looks like:

$sname ='sql206.0fees.us';
$unmae = '0fe_32763096';
$password = 'password';
$db_name= '0fe_32763096_users';
$conn = mysqli_connect($sname,$unmae,$password,$db_name);

if(!$conn){
echo 'Connection Failed';
}
 
use this code to show more errors:
Code:
// show all php errors
ini_set('display_errors', 1);
ini_set('html_errors', 1);
error_reporting(E_ALL);

 $conn = mysqli_connect($sname,$unmae,$password,$db_name);
// check and show the connection errors
if (mysqli_connect_errno()) {
    echo 'Failed to connect to MySQL: ' . mysqli_connect_error();
    exit;
}

if(!$conn) {
    echo 'Connection Failed';
    exit;
}
 
If your website works fine on your laptop but not on other devices, here are a few things to check:

  1. Verify the database credentials in your db_conn.php file.
  2. Confirm the correct hostname for your MySQL server.
  3. Check if your hosting provider allows remote access to the database.
  4. Ensure there are no firewall rules blocking incoming connections.
  5. Verify network connectivity on the other devices.
  6. Enable error reporting to get detailed information on any connection issues.
If the problem persists, contact your hosting provider's support for further assistance.
 
This involves conducting requirements gathering, defining the project scope, and creating a detailed project plan. The cost for this phase typically depends on the complexity of the app and the time required for initial planning and documentation https://mlsdev.com/blog/app-development-cost.
 
Last edited:
Back
Top