Skip to main content

Posts

Showing posts with the label PHP MySql Database

Insert update and delete with parameters in php mysql database its also anti SQL injection

How to INSERT, UPDATE, DELETE with PHP MySQL Securely and its also anti SQL injection  First you create a MySQL database in phpmyadmin (testdb) Download project in zip Insert page : <?php @$conn = mysqli_connect('localhost','root','','testdb') or die("Please check your database username and password") ?> <!doctype html> <html> <head> <meta charset="utf-8"> <title>Insert into table</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> <style> #myform { ...

MYSQLI DELETE table data using Parameters Prepared Statements (PHP)

Select and delete data from MySQL table using PHP help of  Parameters Prepared Statements. The output will be this. Source of  the Main page: <?php @$conn = mysqli_connect('localhost','root','','testdb') or die("Please check your database username and password") ?> <!doctype html> <html> <head> <meta charset="utf-8"> <title>Insert into table</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> <style> #myform { margin:20px; -webkit-box-shadow: 0px ...

MYSQLI SELECT table using Parameters Prepared Statements (PHP)

Select and fetch data from mysql table using PHP help of  Parameters Prepared Statements. Why use parameters in your php applications? This is secure This is error less Faster then any others In this example, you can insert and fetch data from the table. so try this Source : <?php @$conn = mysqli_connect('localhost','root','','testdb') or die("Please check your database username and password") ?> <!doctype html> <html> <head> <meta charset="utf-8"> <title>Insert into table</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrap...

MYSQLI INSERT INTO table using Parameters Prepared Statements (PHP)

Insert data into mysql table using PHP help of  Parameters Prepared Statements. Why use parameters in your php applications? This is secure This is error less Faster then any others Source : <?php @$conn = mysqli_connect('localhost','root','','testdb') or die("Please check your database username and password") ?> <!doctype html> <html> <head> <meta charset="utf-8"> <title>Insert into table</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> <style> #myfo...

How to Create a secure login panel with PHP & Mysql using parameters and session

Secure Login with PHP & Mysql Download project zip Requirement: you need an Apache and MySQL Server database on your device If your computer has xampp or wamp or mamp  or lamp that's great otherwise you need to install Apache and MySQL server Create a database login Run this query : CREATE TABLE admin ( id INT(6) AUTO_INCREMENT PRIMARY KEY, uname VARCHAR(30) NOT NULL, upass VARCHAR(30) NOT NULL ); INSERT INTO `admin` (`id`, `uname`, `upass`) VALUES (NULL, 'admin', 'admin1993'); That means you set your username =  admin and password = admin1993 Login Page: login.php <!doctype html> <html> <head> <meta charset="utf-8"> <title>Login Getway</title> <link rel="stylesheet" href="http://fontawesome.io/assets/font-awesome/css/font-awesome.css" type="text/css"> <style> * { margin:0px; padding:0px; font-family:ar...

How to make connect mysql database with PHP

PHP MYSQLI How to make connection MySQL database for access database. mysql_connect helps to make connection to MySQL Server Connect with  MySQLi Procedural <?php $servername = "localhost"; $username = "root"; $password = ""; $database = "databasename"; $conn = mysqli_connect($servername, $username, $password,$database); if (!$conn) {     die("Connection failed: " . mysqli_connect_error()); } echo "Connected successfully"; ?> Connect with   MySQLi Object-Oriented : <?php $servername = "localhost"; $username = "username"; $password = "password"; $conn = new mysqli($servername, $username, $password); if ($conn->connect_error) {     die("Connection failed: " . $conn->connect_error); } echo "Connected successfully working"; ?> Connect with   PDO (PHP Data Objects) : <?php $servername = ...