Reputation: 1
So I'm attempting an assignment for uni through cloud9 and I am struggling to connect to my database. when I run the application this appears instead of connecting. what i see when running the application
I will post my current code, but it has all been approved by the teacher. and my code in my other .php files have been copied pasted from the teachers files (whose worked on her computer but when I cloned it (and also created a new workspace with it copied pasted) with her exact work the same picture appears.
<?php
require 'functions.php';
// Error reporting
ini_set('display_errors', 1);
error_reporting(E_ALL);
/*MySQL connection settings */
$dbhost = "localhost";
$dbuser = "bmarino";
$dbpass = "";
$dbname = "movie_rentals";
$connection = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname);
//test if connection works
if (mysqli_connect_errno()) {
die ("Database connection failed: " . mysqli_connect_error() . " (" . mysqli_connect_errno . ")"
);
}
echo "connection successful";
?>
i was not the only person in my class to have this appear, and only one student was able to connect successfully (i'm not sure what they did)
Upvotes: 0
Views: 42
Reputation: 1
Okay I figured it out. It was because I had my .php files in a folder, and for some reason when I took them out of the folder the preview loaded! I would delete this question but I might leave it up in case anyone else encounters the same issue :)
Upvotes: 0