Posts

How to Create Inheritance in JAVA

Image
In this article, you will learn How to Create Inheritance in  JAVA . Example:- class Vehicle { protected String brand = "Samsung"; public void honk() { System.out.println("Mobile, LED!"); } } class Car extends Vehicle { private String modelName = "Galaxy"; public static void main(String[] args) { Car myFastCar = new Car(); myFastCar.honk(); System.out.println(myFastCar.brand + " " + myFastCar.modelName); } }  

How to Create Polymorphism in JAVA

Image
  In this article, you will learn How to Create Polymorphism in  JAVA . Example:- class Animal { public void animalSound() { System.out.println("The animal makes a sound"); } } class Pig extends Animal { public void animalSound() { System.out.println("The pig says: wee wee"); } } class Dog extends Animal { public void animalSound() { System.out.println("The dog says: bow wow"); } } class MyMainClass { public static void main(String[] args) { Animal myAnimal = new Animal(); Animal myPig = new Pig(); Animal myDog = new Dog(); myAnimal.animalSound(); myPig.animalSound(); myDog.animalSound(); } }

How to use File Open or Read in PHP

Image
In this article, you will learn How to use File Open or Read in PHP. A method to open file in PHP fopen() function. This function provides you many options than the readfile() function. We can use the type of file with this function. AJAX = Asynchronous JavaScript and XML CSS  = Cascading Style Sheets HTML = Hyper Text Markup Language PHP = PHP Hypertext Preprocessor SQL  = Structured Query Language SVG = Scalable Vector Graphics XML = EXtensible Markup Language Example:- index.php <?php $myfile = fopen("file.txt", "r") or die("Unable to open file!"); echo fread($myfile,filesize("webdictionary.txt")); fclose($myfile); ?> file.txt Welcome to Hub of Tutorials  

How to Generate PDF from MySQL Database

Image
In this article, you will learn How to Generate PDF from  MySQL  Database. Example:- Table of Employees CREATE TABLE IF NOT EXISTS `employee` ( `EmpId` int(11) NOT NULL, `EmpName` varchar(200) DEFAULT NULL, `EmpDepartment` varchar(200) DEFAULT NULL, `EmpRegDate` timestamp NULL DEFAULT CURRENT_TIMESTAMP ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1; INSERT INTO `employee` (`EmpId`, `EmpName`, `EmpDepartment`, `EmpRegDate`) VALUES (1, 'Amandeep Singh', 'Designing', '2017-03-18 11:37:00'), (2, 'Baljit Singh ', 'HR', '2017-06-12 06:32:11'), (3, 'Deepak', 'Tester', '2017-02-13 02:42:39'), (4, 'Gurtej Singh', 'Designing', '2018-05-15 05:28:36'), (5, 'Jaspreet Kaur', 'Development', '2018-04-19 06:12:00'), (6, 'Sachin Sharma', 'Graphics Designer', '2018-11-11 02:31:00'); ALTER TABLE `tblemployee` ADD PRIMARY KEY (`EmpId`); ALTER TABLE `t

How to Maintain Password History Using PHP and Mysql

Image
In this article, you will learn How to Maintain Password History Using PHP and M ysql.  In this user change their password can’t reuse. New Password should not be the same as any of the previous 3 Passwords. In this tutorial having three pages db.php index.php change_password.php db.php <?php define('DB_HOST','localhost'); define('DB_USER','root'); define('DB_PASS',''); define('DB_NAME','pwdhistory'); try { $dbh = new PDO("mysql:host=".DB_HOST.";dbname=".DB_NAME,DB_USER, DB_PASS,array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'utf8'")); } catch (PDOException $e) { exit("Error: " . $e->getMessage()); } ?> index.php <?php session_start(); error_reporting(0); include('db.php'); if(isset($_POST['submit'])) { $fullname=$_POST['fname']; $email=$_POST['email']; $password=md5($_POST['password']); // Code for check email avail

How to Create CSS Image Sprites

Image
In this article, you will learn How to Create  CSS   Image  Sprites. Example:- <html> <head> <title>CSS Image Sprites</title> <style> #navlist { position: relative; } #navlist li { margin: 0; padding: 0; list-style: none; position: absolute; top: 0; } #navlist li, #navlist a { height: 44px; display: block; } #home { left: 0px; width: 46px; background: url('home.png') 0 0; } #prev { left: 63px; width: 43px; background: url('pre.png') -47px 0; } #next { left: 129px; width: 43px; background: url('next.png') -91px 0; } </style> </head> <body> <ul id="navlist"> <li id="home"><a href="https://huboftutorials.com/"></a></li> <li id="prev"><a href="https://huboftutorials.com/category/jquery"></a></li> <li id="next"><a href="https://huboftutorials.com/cascadin

How to Create an Invoicing system in PHP

Image
In this article, we will explain How to Create an Invoicing system in PHP. the invoice will be  inserted  into the database. Example:- form.php <?php error_reporting( error_reporting() & ~E_NOTICE ); $item3=$_POST['item10']; $quantity3=$_POST['qty10']; $price3=$_POST['price10']; $item3=$_POST['item9']; $quantity3=$_POST['qty9']; $price3=$_POST['price9']; $vat=$_POST['vat']; $total=$_POST['total']; $grand=$_POST['grand']; $amount10=$_POST['amount10']; $amount9=$_POST['amount9']; $insert="insert into invoice set item10='$item10',qty10='$quantity10',price10='$price10',amount10='$amount10', item9='$item9',qty9='$quantity9',price9='$price9',amount9='$amount9', total='$total', vat='$vat', grand='$grand',bal='$grand'"; $result=mysql_query($insert); header("location:index.php"); }