This project is a web application designed for a bike showroom. It showcases various functionalities aimed at providing information about available bikes and services.
-
Navigation Bar: The application includes a responsive navigation bar that allows users to navigate easily between different sections such as Home, Services, About, and Contact.
-
Carousel: A carousel feature displays images of bikes, providing a dynamic visual experience for users.
-
About Section: An informative section that introduces users to the showroom and highlights specific bike models like Duke.
-
Search Functionality: A search bar allows users to find specific bikes or services quickly.
- HTML: The structure of the web pages is built using HTML.
- CSS: Styling is applied using an external stylesheet as well as Bootstrap for responsive design.
- JavaScript: Interactive elements such as the carousel and navigation are enhanced with JavaScript.
This project is intended to be a comprehensive platform for users interested in bikes, offering them an intuitive and engaging experience.
The project is organized into several key components:
-
Frontend:
- Contains HTML, CSS, and JavaScript files that handle the user interface and user experience.
- Uses Bootstrap for responsive design, ensuring compatibility across various devices.
-
Backend:
- PHP scripts that handle business logic, including user registration, login, and database interactions.
- Configured to connect to a MySQL database where all application data is stored.
-
Database:
- MySQL database designed to store user information, bike listings, and other relevant data.
This PHP script is responsible for configuring and establishing a connection to a MySQL database for the Bike Showroom web application. It includes essential parameters for connecting to the database and checks if the connection was successful.
/*
This file contains database configuration assuming you are running mysql using user "root" and password ""
*/
$databaseHost = 'localhost'; // The hostname of the MySQL server (typically localhost)
$databaseUsername = 'root'; // The MySQL username (default is often 'root')
$databasePassword = ''; // The MySQL password (empty in this case)
$databaseName = 'bike'; // The name of the database to connect to
// Try connecting to the Database
$conn = mysqli_connect($databaseHost, $databaseUsername, $databasePassword, $databaseName);
// Check the connection
if($conn == false){
die('Error: Cannot connect'); // Display an error message if the connection fails
}
Database Host:
Set to 'localhost', indicating that the MySQL server is hosted on the same machine as the web application.
Database Username:
The username used to authenticate with the MySQL server. In this example, it is set to 'root', which is a common default for local development.
Database Password:
The password associated with the database username. Here, it is left empty, which is often the case for local development setups without a password.
Database Name:
The name of the database to connect to, specified as 'bike'. This database will hold the relevant data for the Bike Showroom application.
Database Connection:
The mysqli_connect function is used to establish a connection to the MySQL database using the provided parameters.
Connection Error Handling:
The script checks whether the connection was successful by evaluating the $conn variable. If the connection fails (returns false), it terminates the script and outputs an error message: 'Error: Cannot connect'.