+ 1

Connecting web site to Sql

I've got an mysql on free hosting where I'm publishing my web site, but I've got a question ho I can connect my database to webpage? the best is to write answer on php cause there are a lot of work with it by php

21st Nov 2019, 5:16 PM
Дмитрий Павлов
Дмитрий Павлов - avatar
2 ответов
+ 6
Дмитрий Павлов For connecting web page to database this is the general code which is common for every page so we create an separate file db connect and include that file in all other web pages The code written in that Connection file is this <?php $name = $_POST['name']; $email = $_POST['email']; $c = $_POST['c']; $message = $_POST['message']; if (!empty($name) || !empty($email)) { $host = "localhost"; $dbUsername = "username"; $dbPassword = "**********"; $dbname = "dbname"; //create connection $conn = new mysqli($host, $dbUsername, $dbPassword, $dbname); if (mysqli_connect_error()) { die('Connect Error('. mysqli_connect_errno().')'. mysqli_connect_error()); } ?>
21st Nov 2019, 5:31 PM
GAWEN STEASY
GAWEN STEASY - avatar
+ 6
Дмитрий Павлов here is an code which I created long back for this purpose has an look over it Some breif about the code First you have to create an form of registration in which you will register user with name and password which will be store in database via php. You need to create three files to understand it clearly 1) connect.php 2) registration.php 3) login.php As you have asked query of how to create login panel then you can follow this code snippet and create registration form and include. https://code.sololearn.com/wNJIukAbu15e/?ref=app
21st Nov 2019, 5:36 PM
GAWEN STEASY
GAWEN STEASY - avatar