Showing posts with label MySQL. Show all posts
Showing posts with label MySQL. Show all posts

Thursday, 5 September 2019

How to connect to mysqli database in php?


Create connection.php file and include all CRUD operation's file for connect database.

<?php
error_reporting(0);
$DB_HOST = 'localhost';
$DB_USER = 'root';
$DB_PASS = '';
$DB_NAME =  'mysql';
$conn = mysqli_connect($DB_HOST,$DB_USER,$DB_PASS,$DB_NAME);
// Check connection
if (!$conn) {
    echo "Failed to Connect to MySQL: " . mysqli_connect_error();
}else{
    echo "Success Connection to MySQL...!";
}
?>

Wednesday, 3 July 2019

How to import an SQL file using the command line in MySQL?









#Step1: Create just databse in your phpMyAdmin
 Ex: test_table.sql

#Step2: put sql databse file in bin folder
 Ex: E:\wamp64\bin\mysql\mysql5.7.26\bin\DB\test_table.sql

# Open CMD
# Step3: Change the directory folder current directory to mysql bin directory.
 C:\Users\kishanvk>CD E:\wamp64\bin\mysql\mysql5.7.26\bin ↲
 C:\Users\kishanvk>E: ↲
 E:\wamp64\bin\mysql\mysql5.7.26\bin>

# Step4: write below command line and in this cmd
 E:\wamp64\bin\mysql\mysql5.7.26\bin>mysql -u [Username] -p [DBNAME] < DB\[DBNAME.sql] ↲

 Ex: E:\wamp64\bin\mysql\mysql5.7.26\bin>mysql -u root -p test_table < DB\test_table.sql ↲

# Step5: Enter password
 Enter password:***** ↲

# Step6: You can see imported database in your phpMyAdmin

Thursday, 6 December 2018

Export Database From MySQL






# Open CMD
# Step1: Change the directory folder current directory to mysql bin directory.
C:\Users\PHPKishan> cd D:\wamp64\bin\mysql\mysql5.7.19\bin ↲

# Step2: write below command line and in this cmd
D:\wamp64\bin\mysql\mysql5.7.19\bin>mysqldump --databases --user=[Username] --password [DBNAME] > [DIR PATH]\[DBNAME.sql] ↲

 EX D:\wamp64\bin\mysql\mysql5.7.19\bin>mysqldump --databases --user=root --password test_table > DB\test_table_bk.sql ↲

# Step3: Enter password
Enter password:***** ↲

# Step4: See exported database in you directory

Wednesday, 25 April 2018

How to get Last Month's record data from MySQL Database?



SELECT * from product_order WHERE YEAR(order_date) = YEAR(CURRENT_DATE - INTERVAL 1 MONTH) and MONTH(order_date) = MONTH(CURRENT_DATE - INTERVAL 1 MONTH)



Tuesday, 24 April 2018

How to get This Month's record data from MySQL Database?


SELECT * from product_order WHERE MONTH(order_date) = MONTH(NOW()) and YEAR(order_date) = YEAR(NOW())


Saturday, 21 April 2018

Tuesday, 3 November 2015

Family Tree In PHP

Create Family Tree In PHP


1st Step : Create these belove file and database
  - CSS : style.css, ddsmoothmenu.css, ddsmoothmenu-v.css
  - JS : ddsmoothmenu.js
  - HTML : tree.html
  - PHP   : index.php, add_member.php, data.php, update.php
       - Database Import : family_tree.sql


Download this Script Click Here