In this article, we will learn about the website visitor activity tracking script. User activity on the online application / Website can be tracked using the Visitor Log. You’ll collect the visitor’s IP address, referrer, browser, and other information when…
Expand +Tag: MYSQL
How to connect a MySQL database with Node.js
MySQL is one of the most common open source databases in the world, and is also effective. Approximately every popular application language, like Java or PHP, provides a driver to access and run operation with MySQL. Node.js and MySQL are…
Expand +How to Generate PDF from Mysql Database using PHP
In this post I will explain you How to Generate PDF from Mysql Database using PHP. To Generate PDF file with mysql data content and output, we will use popular php library FPDF which will help us to generate PDF file.…
Expand +How to Import MySQL Database from SQL File using PHP
Importing SQL script via programming will be useful when we need to create database structure dynamically. For example, if we provide APP or plugin to download and install from online, the dynamic SQL import will be used to setup the…
Expand +How to Create Dynamic Category Subcategory Tree using PHP and MySQL
Category and subcategory tree view structure gives an easy to use approach to list the parent and child categories. The category and their subcategory are effectively isolated by a tree structure. The categories tree view is constantly recommended to display…
Expand +How to write connection class to mysql database using php
Hello! In this post, you will learn to how to write and test the OOP based connection class to mysql database using php. see below..how to do it.. connection.php
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
<?php /** @author tutorialswebsite *@ copyright 2016 */ class createDBConnection // create a class for make connection { var $host="localhost"; var $username="username"; var $password="password"; var $database="database name"; var $dbconn; function connectToDatabase() //specify the server details for mysql { $conn=mysql_connect($this->host,$this->username,$this->password); if(!$conn)//testing the connection { die("Cannot connect to the database"); }else{ $this->dbconn=$conn; echo "Connection established"; } return $this->dbconn; } function selectDatabase() // selecting the database { //use php inbuild function foer select database mysql_select_db($this->database); if(mysql_error()) // if error occured display the error message { echo "Cannot find the database".$this->database; } echo "Database Selected.."; } function closeConnection() // close the connection { mysql_close($this->dbconn); echo "Connection closed"; } } ?> |
Now you have create the database connection class let’s see…
Expand +How to create pagination using PHP and MYSQL
Paging (Pagination) means showing Database results in multiple pages instead of one long page. if we have more than 100 records in database and we want to show all results but not in a single page, so we can devide…
Expand +