Website URL
dcreport.rf.gd
Other Information
database name: if0_36404717_dcreports
Hi and welcome to the forum! Can you please explain your issue more clearly?
From the title, it seems like the security system is your issue:
How do i allow my php file to load data from my database? The browser says some CORB stuff
That description makes no sense to me.
Connecting to the database from PHP is done directly from the PHP code to the database server. PHP has modules like MySQLi and PDO to do that. Browsers are no part of the database connection.
If you’re trying to load data with PHP, but the script can’t be accessed due to CORS, then that’s a completely different issue. CORS only controls whether you can reach that script, it has no influence on what the script can do.
Don’t know if it’ll help, but here’s the PHP I use to connect to my infinity free database from my site:
<?php
// Database connection
$servername = "SERVER NAME";
$username = "USER NAME";
$password = "PASSWORD";
$dbname = "DATABASE NAME";
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Fetch records in reverse ID order
$sql = "SQL";
$result = $conn->query($sql);
?>
Just replace the details at the top with your database details (from your dashboard.
and SQL with the sql you want to run.
That information doesn’t really help.
If I understand your message correctly, you see CORB errors in your browser. And you believe that these CORB errors are caused by a problem with your database connection.
But as I explained before, that seems very unlikely to me.
But mainly, I can’t solve the issue if I don’t know what the issue is. Can you please describe the exact issue you see? And especially share any error messages you get?
In addition to what @Admin said earlier, unless the database came from unaffiliated web server, the CORS was not likely the reason why you’ve encountered such issue.
You did not even specify any detail about the CORS failure. It might be unrelated to database stuff. It might be a stylesheet, a script, an image or any other type of resource that might have caused the failure.
I could not even replicate the CORS issue; I couldn’t find any error in developer’s console that indicate any potential CORS failure on your website. Are you even certain that there has been a CORS failure?
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.