Filip Grujic
Filip Grujic

Reputation: 3

How to connect to database on freewebhostingarea?

Ok so i am making account system for my website. I am using freewebhostingarea as host. But i dont know what is servername(for connecting to database). Can you help me? Here is my code for connecting:

<?php
    $servername = "";
    $server = "root";
    $password = "my password";
    $dbName = "name";
    $conn = mysqli_connect($servername, $server, $password, $dbName);
?>

I dont know what is $servername for freewebhoatingarea. Pls reply.

Upvotes: -2

Views: 631

Answers (1)

Ginxxx
Ginxxx

Reputation: 1648

It's all the same actually . I want you to try this 4 steps

  1. After you hit create databaase it will give you an option to name/rename your database so save that name to something like a notepad for your reference

(e.g) freehosting_db_(sampledatabase)

  1. Next to that it that before you hit next on the creation of database kindly remember that password that you are going to make and like the name of the website save it to a notepad so you can remember the password

(e.g) xHsnaAXa123 -> password database

  1. Mostly the server always localhost on SOME freehosting

  2. The servername is automatically generated so look for it. It will be something like

(e.g) freehosting_db_(sampledatabase)_user

And to set that up

$servername = "freehosting_db_(sampledatabase)_user";
$server = "localhost";
$password = "xHsnaAXa123";
$dbName = "freehosting_db_(sampledatabase)";

PS: This is mostly how you setup a connection from your database to your server . But it is always depends on the the hosting that you are going to use . Godadday, Hostgator, 000webhostingapp, they are all alike on how setting it up .

Upvotes: 0

Related Questions