MySQL help needed

Helo please can somebody teach me how to connect my php to mySQL in infinityfree please?

it needs vPanel password I think but I don’t have it any helps?

Your database password is the hosting account password, that can be found by logging in your Client Area, selecting the hosting account on where you need to connect your software to the MySQL server, scrolling down to “Account Details” and clicking on “Show/Hide” to show the password.

1 Like

After you’ll need to connect like this:

<?php
$servername = "sqlxxx.epizy.com";
$username = "username";
$password = "password";
$dbname = "database name";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}
//other actions
?>

or

<?php
define("DB_HOST","sqlxxx.epizy.com");
define("DB_USER","username");
define("DB_PASS","password");
define("DB_NAME","db name");

// Create connection
$conn = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}
//other actions
?>
2 Likes

where do i find those information and tose username and pass please

You can find the database host on the “MySQL Databases” section of the Control Panel. If you want username and password:

1 Like

and whats servername

from mysql database section
http://cpanel.epizy.com/panel/indexpl.php?option=mysql&ttt=776627963145224192

1 Like

where do i put that code in index.php or?

you can put them in conn.php

then include them into files by:

<?php

include "conn.php";
?>
1 Like

and if i want to make a login or register page?

you can use this tutorial

On that tutorial @anon19508339 linked to you, skip step 2, and replace config.php with conn.php and $link with $conn, also selecting the Object-Oriented part of code.

1 Like

where do i say include in index.php? man do you have any instant messangers so i can contact you?

just put it in index.php when you want to connect:

<?php

include "conn.php";
?>

i mean. the forum itself is okay.

Guys if i want to make a login page i have to have a MySQL ok then I have to connect it right so its a valid information and any tutorials on that?

i already posted the tutorial. you can follow it up. :slight_smile:

yes it is

1 Like

it means the password is invalid. The DB Password is your site cpanel password

1 Like

I repeat: you can find your database password by logging in your Client Area, selecting the hosting account on where you need to connect your software to the MySQL server, scrolling down to “Account Details” and clicking on “Show/Hide” to show the password.

1 Like

link :-/