Monday 7 August 2017

Creating Price Range Slider using jQuery in PHP with MySQL

In this tutorials we will create Jquery Ajax price range slider with
PHP,Mysql .This is very useful for user that allow to filter data/items based on rang slider drag rather than typing price .
Nowadays , this is quite common requirements for websites that have products to display or sell .

Visit Tutorial : http://unitedwebsoft.in/blog/creating-price-range-slider-using-jquery-php-mysql/

Saturday 22 July 2017

Access website from IP address on our local PC


Generally the website can be accessed by typing http://server_ip/~cpanelusername/
on the server’s cpanel without Domain name Server ( DNS ) pointing .
But in some hosting provider disable this feature due to security reasons . Thus ‘mod_userdir’ is disabled and you can’t enable it on your shared hosting .
However , we have an alternate method to test our new server .
Follow below tutorials : http://unitedwebsoft.in/blog/access-website-without-domain-name-assigned/

Wednesday 5 July 2017

Send Email via SMTP Server in PHP using PHPMailer

Any web application may need send email through it’s script. In PHP, we use mail() function to send from web server .However sometimes it may cause delivery issue.
Means when we send email from php using just mail() function , sometimes recipient don’t receive the mail .To overcome this issue we need SMTP to send email in php .
Visit tutrials link


http://unitedwebsoft.in/blog/send-email-via-smtp-server-php-using-phpmailer/

Tuesday 23 May 2017

Connect and Handle Files in FTP Server using PHP

It is important for any web developers for upload files to server using FTP. We know there are plenty of FTP clients available
in market like filezilla, cute ftp etc .
PHP also provide lots of functions to handle files on FTP server . In this below PHP tutorial we will guide you how to use PHP scripts
to handle files in FTP server .

Read more :
http://unitedwebsoft.in/blog/connect-handle-files-ftp-server-using-php/

Friday 31 March 2017

Creating dynamic Photo Gallery with jQuery, PHP & MySQL


PHP,Jquery Tutorial on
How to create Dynamic image,photo gallery in php mysql using jquery ?
learn to easily create image gallery with php,mysql
Visit tutorial here :
http://unitedwebsoft.in/blog/creating-dynamic-photo-gallery-jquery-php-mysql/

Photo Galley is a most used section in any website . We can use photo gallery to display portfolio images , event’s photos, client’s logo etc .
Today we will creating a dynamic photo gallery using Jquery in PHP, Mysql.

We also integrate fancybox image pop up for displaying larger image when user clicks on thumb image .

Thursday 16 March 2017

Send mail from laravel PHP framework and configure SMTP

lots of web server do not allow to directly send email from website .They require SMTP authentication for security purpose.

We have created a laravel tutorial for Sending email and configuring SMTP in web server .
Visit for this tutorial http://unitedwebsoft.in/blog/send-mail-laravel-php-framework-configure-smtp/

Friday 3 March 2017

Some cases where PHP short tags should be avoided

Most of the time when creating email template in PHP , we may need to separate some files and include these .
But including these files with shorthand cause some display problem .
<?=include('includes/header.php');?> 

Well, short tags are used for simple variable output and not a piece of HTML .
So we have to use like below .
<?php include('includes/header.php'); ?> 
Looking to build your career in Web Development .Visit us www.unitedwebsoft.in for complete advance Web Development , PHP course .We cover a complete e-commerce project based training that build your confidence to do any web project .We also started Laravel PHP MVC framework training
Short tags were, for a time, the standard in the PHP world; however, they do have the major drawback of conflicting with XML headers and, therefore, have somewhat fallen by the wayside .
In our experience most servers do have short tags enabled.
<?=
is far more convenient than typing
<?php echo 
From PHP 5.4.0 the short_open_tag mandate does exclude the short echo tag ! This is essential as the utilization of all other short echos is viewed as vain. In any case the utilization of the short echo tag is supported starting now and into the foreseeable future. It provides for a smoother and tidier code-base – esp. in view documents. So for PHP >= 5.4.0 can be utilized without setting short_open_tag. Kindly don’t utilize the other short tag in your code .
Original tutorial link : http://unitedwebsoft.in/blog/cases-php-short-tags-avoided/

Tuesday 21 February 2017

PHP ,Mysql Pagination with jQuery Ajax

Pagination is very important part in any web project .Because all large records of items can’t load in a single page .
We require pagination to show these items in multiple pages . Well Jquery,Ajax pagination enhance user experience on your website .
So, today i am writing tutorials on PHP pagination with Jquery,Ajax .

We will use PHP to fetch post from Mysql database with pagination . Jquery,Ajax will do the work for loading records according to pagination click without page reloading .
We should have below files before starting any work .

    pagination.php
    config.php
    get_data.php
    index.php
    jquery.js
    style.css

Database Creation

We have to create a table ‘posts’ to store records , Find below sql code to create ‘posts’ database table .
 
CREATE TABLE `posts` (
 `id` int(11) NOT NULL AUTO_INCREMENT,
 `title` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
 `content` text COLLATE utf8_unicode_ci NOT NULL,
 `created` datetime NOT NULL,
 `modified` datetime NOT NULL,
 `status` tinyint(1) NOT NULL DEFAULT '1' COMMENT '1=Active, 0=Inactive',
 PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

Pagination Class

We have created a paginator class to show pagination . Find below some basic configuration in this class that you can customize as per your requirements .
baseURL – baseURL holds the URL to send Ajax request .
totalRows – Total number of records.
perPage – How many records you want to display on per page.
contentDiv – Give the ID of the element where the pagination data would be displayed.
Uses of the Pagination class
<?php
// Pagination  settings
$pagConfig = array('baseURL'=>'get_data.php', 'totalRows'=>$rowCount, 'perPage'=>$limit, 'contentDiv'=>'posts_content');
// Initialize pagination class
$pagination =  new Pagination($pagConfig);
?>


<!-- Display pagination links -->
<?php echo $pagination->createLinks(); ?>

config.php File

For Databse connection and DB select
connect_error) {
die(“Connection failed: ” . $db->connect_error);
}
?>

index.php File

This file contains some Jquery, PHP, and HTML code. Full script of index.php file have mentioned separately below.
Jquery:
Include the jQuery library to working with jQuery and Ajax. Also, some jQuery would require for show and hide loading overlay at the time of Ajax request.
<script src="jquery.js"></script>
<script type="text/javascript">
// Show loading overlay when ajax request starts
$( document ).ajaxStart(function() {
    $('.loading-overlay').show();
});
// Hide loading overlay when ajax request completes
$( document ).ajaxStop(function() {
    $('.loading-overlay').hide();
});
</script>

PHP & HTML :

With the pagination links, will will display limited no. of records . To display the pagination links, you have to create an object of the Pagination class. Also, you can pass the configuration of the pagination links within Pagination class. Call the createLinks() function of the Pagination class to displaying the pagination links.
<div class="post-wrapper">
    <div class="loading-overlay"><div class="overlay-content">Loading.....</div></div>
    <div id="posts_content">
    
 <?php
    //Include Pagination class file
    include('pagination.php');
    
    //Include database configuration file
    include('config.php');
    
    $limit = 10;
    
    //Get the total number of rows
    $queryNum = $db->query("SELECT COUNT(*) as postNum FROM posts");
    $resultNum = $queryNum->fetch_assoc();
    $rowCount = $resultNum['postNum'];
    
    //Initialize Pagination class and create object
    $pagConfig = array('baseURL'=>'getData.php', 'totalRows'=>$rowCount, 'perPage'=>$limit, 'contentDiv'=>'posts_content');
    $pagination =  new Pagination($pagConfig);
    
    //Get rows

    $query = $db->query("SELECT * FROM posts RDER BY id DESC LIMIT $limit");
    
    if($rowCount > 0){ ?>
        <div class="posts_list">
        <?php
            while($row = $query->fetch_assoc()){ 
                $postID = $row['id'];
        ?>
            <div class="list_item"><a href="javascript:void(0);"><h2><?php echo $row["title"]; ?></h2></a></div>
        <?php } ?>

        </div>
        <?php echo $pagination->createLinks(); ?>
    <?php } ?>
    </div>
</div>

get_data.php File

This page called by Ajax. Here We’ll get the page number of the pagination link and fetch the respective posts data.
query(“SELECT COUNT(*) as postNum FROM posts”);
$resultNum = $queryNum->fetch_assoc();
$rowCount = $resultNum[‘postNum’];
//initialize Pagination class
$pagConfig = array(‘baseURL’=>’getData.php’, ‘totalRows’=>$rowCount, ‘currentPage’=>$start, ‘perPage’=>$limit, ‘contentDiv’=>’posts_content’);
$pagination = new Pagination($pagConfig);
//get rows
$query = $db->query(“SELECT * FROM posts ORDER BY id DESC LIMIT $start,$limit”);
if($rowCount > 0){ ?>
fetch_assoc()){
$postID = $row[‘id’];
?>

createLinks(); ?>

CSS (style.css)

Below css used for pagination links layout , you can customize it as per your website designs.
div.pagination {
    font-family:Arial, Helvetica, sans-serif;
    padding:20px;
    margin:7px;
}

div.pagination a {
    margin: 2px;
    padding: 0.5em 0.64em 0.43em 0.64em;
    background-color: #ee4e4e;
    text-decoration: none;
    color: #fff;
}
div.pagination a:hover, div.pagination a:active {
    padding: 0.5em 0.64em 0.43em 0.64em;
    margin: 2px;
    background-color: #de1818;
    color: #fff;
}
div.pagination span.current {
    padding: 0.5em 0.64em 0.43em 0.64em;
    margin: 2px;
    background-color: #f6efcc;
    color: #6d643c;
}
div.pagination span.disabled {
    display:none;
}
Finally you have successfully integrated PHP Pagination with Jquery and Ajax . If you looking more PHP tutorials visit here.
For advance level PHP Project based training visit here .