Topic: php

jQuery Facebook Like Infinite Scroll Pagination in PHP MySQLi 0

jQuery Facebook Like Infinite Scroll Pagination in PHP MySQLi

Today, We want to share with you jQuery Facebook Like Infinite Scroll Pagination in PHP MySQLi.
In this member we will show you jQuery Infinite Scroll using PHP MySQLi, hear for auto load more data on page scroll with jquery & php we will give you demo and example for implement.
In this member, we will learn about Load Data on Page Scroll from MySQLi Database using jQuery Ajax PHP with an example.

jQuery Facebook Like Infinite Scroll Pagination in PHP MySQLi

There are the Following The simple About jQuery Facebook Like Infinite Scroll Pagination in PHP MySQLi Full Information With Example and source code.

As I will cover this Post with live Working example to develop PHP – Infinite Scroll Pagination using JQuery Ajax Example, so the some major files and Directory structures for this example is following below.

  • index.php
  • db.php
  • tbl_members.sql
  • loadMoreData.php

Infinite Scroll Pagination Database Connection

db.php

Database Script

Table structure for table `tbl_members`

CREATE TABLE IF NOT EXISTS `tbl_members` (
`id` int(11) NOT NULL,
  `title` varchar(100) NOT NULL,
  `link` varchar(255) NOT NULL,
  `content` text NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=latin1;

--
-- Indexes for table `tbl_members`
--
ALTER TABLE `tbl_members`
 ADD PRIMARY KEY (`id`);

--
-- AUTO_INCREMENT for table `tbl_members`
--
ALTER TABLE `tbl_members`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=23;

index.php

This is where I will make a simple HTML form and PHP server side source code for our web application. To make the forms simply all souce code copy and write it into your any text editor Like Notepad++, then save file it as index.php.



<title></title>


body {
    font-family: Arial;
    background: #e9ebee;
    font-size: 0.9em;
}

.member-wall {
    background: #FFF;
    border: #e0dfdf 1px solid;
    padding: 20px;
    border-radius: 5px;
    margin: 0 auto;
    width: 500px;
}

.member-item {
    padding: 10px;
    border: #c6000 1px solid;
    border-radius: 5px;
    margin-bottom: 30px;
}

.member-title {
    color: #3d3d3d;
}

.ajax-loader {
    display: block;
    text-align: center;
}
.ajax-loader img {
    width: 50px;
    vertical-align: middle;
}



    <div class="member-wall">
        <div id="member-list">
            
            <input type="hidden" name="total_count" id="total_count"
            value="" />

            
                <div class="member-item" id="">
                    <p class="member-title"></p>
                    <p></p>
                </div>
                
            </div>
            <div class="ajax-loader text-center">
                <img src="LoaderIcon.gif"> Loading more members...
            </div>
    </div>


$(document).ready(function(){
        windowOnScroll();
});
function windowOnScroll() {
       $(window).on("scroll", function(e){
        if ($(window).scrollTop() == $(document).height() - $(window).height()){
            if($(".member-item").length < $("#total_count").val()) {
                var memIdLast = $(".member-item:last").attr("id");
                //loadMoreData(memIdLast);
            }
        }
    });
}

function loadMoreData(memIdLast) {
       $(window).off("scroll");
    $.ajax({
        url: 'loadMoreData.php?memIdLast=' + memIdLast,
        type: "get",
        beforeSend: function ()
        {
            $('.ajax-loader').show();
        },
        success: function (data) {
        	   setTimeout(function() {
                $('.ajax-loader').hide();
            $("#member-list").append(data);
            windowOnScroll();
        	   }, 1000);
        }
   });
}



Load Recent Members using PHP

loadMoreData.php

<?php
require_once('db.php');

$memIdLast = $_GET['memIdLast'];
$memSqlQQ = "SELECT * FROM tbl_members WHERE id 
    <div class="member-item" id="">
        <p class="member-title">  </p>
        <p></p>
    </div>
    

Angular 6 CRUD Operations Application Tutorials

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Ajax Infinite Scroll Using jQuery, PHP and MySQL.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this member, don’t forget to share.

PHP Future 0

PHP Future

Today, We want to share with you PHP Future.In this post we will show you Future of PHP Development, hear for The Present and Future Trends for PHP Development we will give you demo and example for implement.In this post, we will learn about What is the future scope of php for web development with an example.

PHP Future

There are the Following The simple About PHP Future Full Information With Example and source code.

As I will cover this Post with live Working example to develop Future of PHP Developer, so the php future scope 2020 for this example is following below.

What is PHP?

The Simple expansion of the Main PHP is Hypertext Pre-processor is a main widely used server-side Programming script language for used to web development and api and for other general database related purposes.

The Future of PHP

  • 1. Easy to update
  • 2. Ample Documentation
  • 3. PHP Experts Availability
  • 4. PHP libraries
  • 5. support for MS SQL, MySQL and Oracle databases.
  • 7. MVC framework support
  • 8. open source programming language, which free of cost.
  • 9. PHP support multiple platforms as well as web servers
  • 10.

There are the list of popular Social websites which are using PHP Programming Language

Top PHP Frameworks in 2019

  • Laravel
  • Symfony
  • Zend Framework
  • Cake PHP
  • CodeIgniter
  • Phalcon
  • Yii Framework
  • Fat-Free
  • Kohana
  • FuelPHP
  • Flight
  • Zikula
  • PHPixie
  • Slim
  • Li3
  • Nette
Angular 6 CRUD Operations Application Tutorials

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about PHP Future.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

PHP Laravel Middleware Route Groups 0

PHP Laravel Middleware Route Groups

Today, We want to share with you PHP Laravel Middleware Route Groups.In this post we will show you laravel route group middleware, hear for Laravel 5.7 Middleware Tutorial With An Example we will give you demo and example for implement.In this post, we will learn about Combined route group with prefix and auth middleware with an example.

PHP Laravel Middleware Route Groups

There are the Following The simple About PHP Laravel Middleware Route Groups Full Information With Example and source code.

As I will cover this Post with live Working example to develop laravel auth:api middleware, so the laravel middleware except for this example is following below.

Laravel Middleware group Advantages

There are list of the main advantages of Very useful middleware group in Laravel

  • It simple way to generalize the Laravel Auth source code.
  • We all the save time from reuseble multiple middleware names in multiple places.
  • If You Want to create a middleware in all Laravel 5.7 routes, don’t worry We can just simple add in middleware group.
  • Reduces the complexity.

Setting up middleware group in Laravel

We will display a protected PHP class variable Like as name “$middlewareGroups” which stores simple PHP an empty array

app/Http/Kernel.php

/**
* The Laravel 5.7 application's route middleware groups.
*
* @var array
*/
protected $middlewareGroups = [
	'web' => [
		\App\Http\Middleware\EncryptCookies::class,
		\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
		\Illuminate\Session\Middleware\StartSession::class,
		// \Illuminate\Session\Middleware\AuthenticateSession::class,
		\Illuminate\View\Middleware\ShareErrorsFromSession::class,
		\App\Http\Middleware\VerifyCsrfToken::class,
		\Illuminate\Routing\Middleware\SubstituteBindings::class,
	],
	'api' => [
		'throttle:60,1',
		'bindings',
		'cors'
	],
	'both' => [
		'web',
		'api'
	]
];

Laravel middleware groups

And then, let’s simple code display how we can use these Laravel 5.7 middleware groups in routes/api.php

routes/api.php

Route::group(['middleware' => ['permission', 'api']], function(){
Route::get('product/access_permissions', 'API\Product\[email protected]');
Route::get('product/dashboard', 'API\Product\[email protected]');
Route::get('product/members', 'API\Product\[email protected]');
Route::get('product/member/{member_id}', 'API\Product\[email protected]');
Route::put('product/member/assign_roles/{member_id}', 'API\Product\[email protected]');
});

Angular 6 CRUD Operations Application Tutorials

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about PHP Laravel Middleware Route Groups.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

PHP How-to create Dynamic PDF Files using FPDF 0

PHP How-to create Dynamic PDF Files using FPDF

PHP How-to create Dynamic PDF Files using FPDF

In this Post We Will Explain About is PHP How-to create Dynamic PDF Files using FPDF With Example and Demo.Welcome on Pakainfo.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to Generating PDF files with PHP and FPDF Example

In this post we will show you Best way to implement How-to create PDF documents using PHP, hear for Generate PDF from MySQL Data using FPDF with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

PHP Script to create PDF document using FPDF

First of all simple, you need to download FPDF libs. Download FPDF from here FPDF Download

http://www.fpdf.org

and then Keep the include the fpdf.php file in your root working directory,and then keep the font simple directory in the same root place.

After that Run this source code ,and then you are know or ready with your simple first pdf file created from simple external FPDF class. Example of How to create PDF with PHP

AddPage();
$mypdf->SetFont('Arial','B',18);
$mypdf->Cell(80,10,'Hello World!',1,0,R,true,'http://www.Pakainfo.com');
$mypdf->Output('live_myfile.pdf','D'); // here Force download using FPDF to user machine as live_myfile.pdf
?>

In the above simple source code we have used simple descign cell to add our new create text to the FPDF to pdf file. We have simple just added one text line Like as a ‘Wel-come to Pakainfo.com’ as well as simple created the pdfdouments file. Here more example is the simple details of Cell. Try to change the simple source code script by adding backgroud css color like this.

$mypdf->SetFillColor(193,229,252);
$mypdf->Cell(80,10,'Wel-come to Pakainfo.com',1,0,R,true,'http://www.Pakainfo.com');
$mypdf->Output('live_myfile.pdf','D'); 

We used to simple $mypdf->Output(‘my_file’,’D’) to get some here output simple directly. This line will force download to user machine the pdf file my_file.pdf. We can some data change this to serever side save the data file in local simple data PHP ( server ) side machine.

$mypdf->Output('live_myfile.pdf','F'); // devloped by live24u Saved at local ( server side )  as live_myfile.pdf
//$mypdf->Output('live_myfile.pdf','I'); //devloped by live24u Send to browser and simple displayed wiht the plugin, data file can be simple saved using  data set file name. 
//$mypdf->Output('live_myfile.pdf','S'); //devloped by live24u Output as sting , here simple php file name is ignored.  

You are Most welcome in my youtube Channel Please subscribe my channel. and give me FeedBack.
More Details……
Angularjs Example

Example

I hope you have Got What is How to create a dynamic PDF using PHP And how it works.I would Like to have FeedBack From My Blog(Pakainfo.com) readers.Your Valuable FeedBack,Any Question,or any Comments about This Article(Pakainfo.com) Are Most Always Welcome.

Extract XML Response in PHP Example 0

Extract XML Response in PHP Example

Today, We want to share with you Extract XML Response in PHP Example.In this post we will show you Parse XML Response in PHP Example, hear for Interprets a string of XML into an object we will give you demo and example for implement.In this post, we will learn about Parsing SOAP responses with PHP’s SimpleXML with an example.

Extract XML Response in PHP Example

There are the Following The simple About Extract XML Response in PHP Example Full Information With Example and source code.

As I will cover this Post with live Working example to develop php xml to json with attributes, so the xml to json php manually for this example is following below.

XML File

simple XML structured string

properly formatted XML

<?xml version='1.0'?>
<business>
    <website>Pakainfo.com Blog</website>
    <createdby>Jaydeep Gondaliya</createdby>
    <devlopers>
        <devloper>
            <adminusername>Jaydeep</adminusername>
            <superadmin>Gondaliya</superadmin>
        </devloper>
        <devloper>
            <adminusername>Astha</adminusername>
            <superadmin>Bhanderi</superadmin>
        </devloper>
    </devlopers>
</business>

PHP Convert XML Response

PHP string variable called $xmlResponse

simplexml_load_string i PHP

$xml = simplexml_load_string($xmlResponse);

creating an array of our devlopers

PHP Create An Array

$devlopers = array();
foreach($xml->devlopers as $devloper) {
    $devloperObject = array(
        "adminusername" => $devloper->adminusername,
        "superadmin" => $devloper->superadmin
    );
    array_push($devlopers, $devloperObject);
}

add the devlopers array to a custom object

$jsonObject = array(
    "website" => $xml->website,
    "createdby" => $xml->createdby,
    "devlopers" => $devlopers
);

PHP converting simple custom object using the Add to Json methods

Json::encode($jsonObject);

You can following onther way to PHP Convert XML to JSON

Parse An XML Response With PHP

JSON result of our XML response

Response For JSON

{
  "website": "Pakainfo.com Blog",
  "createdby": "Jaydeep Gondaliya",
  "devlopers": [
    {
      "adminusername": "Jaydeep",
      "superadmin": "Gondaliya"
    },
    {
      "adminusername": "Astha",
      "superadmin": "Bhanderi"
    }
  ]
}

Angular 6 CRUD Operations Application Tutorials

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Extract XML Response in PHP Example.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Laravel 5.7 Route Group Names Example 0

Laravel 5.7 Route Group Names Example

Today, We want to share with you Laravel 5.7 Route Group Names.In this post we will show you Laravel resource route multiple parameters, hear for Laravel Route Group Middleware Auth we will give you demo and example for implement.In this post, we will learn about Laravel Redirect Tutorial Example From Scratch with an example.

Laravel 5.7 Route Group Names

There are the Following The simple About Laravel 5.7 Route Group Names Full Information With Example and source code.

As I will cover this Post with live Working example to develop Laravel Route pass multiple Parameters Examples, so the some major files and Directory structures for this example is following below.

A small new feature in Laravel 5.7 – just for those who want to group their Laravel routes a little more some properly. And then we can add a Laravel 5.7 prefix not only to routes, So to the Laravel route groups as well.

Define route group name in laravel 5.7

Route::group(['prefix'=>'products','as'=>'product.'], function(){
    Route::get('/', ['as' => 'index', 'uses' => '[email protected]']);
    Route::get('item', ['as' => 'item', 'uses' = > '[email protected]']);
});

Laravel 5.7 Update

{{ $routeName = \Request::route()->getName() }}

@if(strpos($routeName, 'product.') === 0)
    // do Laravel 5.7 something
@endif

Get Current Route Name using Laravel

Resource route names

Route::match( array( 'GET', 'POST' ), 'YOUR ', array(
	'as' => '',
	'uses' => 'Aimeos\Shop\Controller\@'
));

Angular 6 CRUD Operations Application Tutorials

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Laravel 5.7 Route Group Names.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

PHP Laravel Add Days Hours Minutes To Datetime 0

PHP Laravel Add Days Hours Minutes To Datetime

Today, We want to share with you PHP Laravel Add Days Hours Minutes To Datetime.In this post we will show you add hours and minutes to date in Laravel, hear for Add Days, Weeks, Months, Year to the Existing date in Laravel we will give you demo and example for implement.In this post, we will learn about How to add Days, Hours, Minutes, and Seconds to Datetime in Laravel with an example.

PHP Laravel Add Days Hours Minutes To Datetime

There are the Following The simple About PHP Laravel Add Days Hours Minutes To Datetime Full Information With Example and source code.

As I will cover this Post with live Working example to develop Add hours and minutes with PHP Laravel, so the Laravel PHP Dates and Times With Carbon for this example is following below.

How to Add Days to Date in Laravel 5.7

add days to displayed created_at date

$new_date = $start->copy()->addDays(5);
dd($new_date);
or

$new_date = clone($start_date)->addDays(5);
dd($new_date);

add 1 hour to date Carbon

$date = Carbon::parse('2019-11-24 11:59:56')->addHour();
protected $dates = ['notify_at'];

//get date
$date = $model->notify_at->addHour();
dd($date);

$cr_date = "2019-11-24 11:59:56";
$carbon_date = Carbon::parse($cr_date);
$carbon_date->addHours(1);
dd($carbon_date);

Laravel Adds an amount of days, months, years, hours, minutes and seconds to a DateTime object

How to Add Years to Date in Laravel

$cr_date = Carbon::create(2021, 1, 31, 0);

echo $cr_date->toDateTimeString();  // 2021-01-31 00:00:00
echo $cr_date->addYears(5);         // 2019-01-31 00:00:00
echo $cr_date->addYear();           // 2018-01-31 00:00:00
echo $cr_date->subYear();           // 2019-01-31 00:00:00
echo $cr_date->subYears(5);         // 2021-01-31 00:00:00

How to Add Months to Date in Laravel

echo $cr_date->addMonths(60);   // 2019-01-31 00:00:00
echo $cr_date->addMonth();      // 2019-03-03 00:00:00 equivalent of 
$cr_date->month($cr_date->month + 1); //so it wraps
echo $cr_date->subMonth();     // 2019-02-03 00:00:00
echo $cr_date->subMonths(60);  // 2021-02-03 00:00:00

How to Add Days to Date in Laravel

echo $cr_date->addDays(29);  // 2021-03-03 00:00:00
echo $cr_date->addDay();     // 2021-03-04 00:00:00
echo $cr_date->subDay();     // 2021-03-03 00:00:00
echo $cr_date->subDays(29);  // 2021-02-03 00:00:00

How to Add Week Days to Date in Laravel

echo $cr_date->addWeekdays(4);  // 2021-02-09 00:00:00
echo $cr_date->addWeekday();    // 2021-02-10 00:00:00
echo $cr_date->subWeekday();    // 2021-02-09 00:00:00
echo $cr_date->subWeekdays(4);  // 2021-02-03 00:00:00

How to Add Weeks to Date in Laravel

echo $cr_date->addWeeks(3);   // 2021-02-24 00:00:00
echo $cr_date->addWeek();     // 2021-03-02 00:00:00
echo $cr_date->subWeek();     // 2021-02-24 00:00:00
echo $cr_date->subWeeks(3);   // 2021-02-03 00:00:00

How to Add Hours to Date in Laravel

echo $cr_date->addHours(24);   // 2021-02-04 00:00:00
echo $cr_date->addHour();      // 2021-02-04 01:00:00
echo $cr_date->subHour();      // 2021-02-04 00:00:00
echo $cr_date->subHours(24);   // 2021-02-03 00:00:00

How to Add addMinutes to Date in Laravel

echo $cr_date->addMinutes(61);  // 2021-02-03 01:01:00
echo $cr_date->addMinute();     // 2021-02-03 01:02:00
echo $cr_date->subMinute();     // 2021-02-03 01:01:00
echo $cr_date->subMinutes(61);  // 2021-02-03 00:00:00

How to Add Seconds to Date in Laravel

echo $cr_date->addSeconds(61);  // 2021-02-03 00:01:01
echo $cr_date->addSecond();     // 2021-02-03 00:01:02
echo $cr_date->subSecond();     // 2021-02-03 00:01:01
echo $cr_date->subSeconds(61);  // 2021-02-03 00:00:00    

Angular 6 CRUD Operations Application Tutorials

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about PHP Laravel Add Days Hours Minutes To Datetime.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

PHP Get Current URL Full Path HTTP-HTTPS Protocol 0

PHP Get Current URL Full Path HTTP-HTTPS Protocol

PHP Get Current URL Full Path HTTP-HTTPS Protocol

In this Post We Will Explain About is PHP Get Current URL Full Path HTTP-HTTPS Protocol With Example and Demo.Welcome on Pakainfo.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to php get http or https from urlExample

In this post we will show you Best way to implement PHP Get Site URL Protocol HTTP or HTTPS, hear for php – Identify whether the current url is http or https in a projectwith Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

php check if url contains http or https using PHP

<?php
	$set_domain_name =  $get_current_protocol = $get_current_domain = "";
	$get_current_protocol = ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') || 
    $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://";
    $get_current_domain = $_SERVER['HTTP_HOST'];
    $set_domain_name = $get_current_protocol.$get_current_domain;
	var_dump(set_domain_name);
	
	
    $base_image_url = $set_domain_name."/admin/upload/images/";
	var_dump(base_image_url);
	
	
	$temp = explode(".", $_FILES["upload"]["name"]);
	$newfilename = date("Ymd").round(microtime(true)) . '.' . end($temp);
	move_uploaded_file($_FILES["upload"]["tmp_name"],"images/".$newfilename);
	$image_url = $base_image_url . $newfilename;
	
	echo "<br> Simple Stored in: " . $image_url;
?>

PHP Simple Get Site URL Protocol – “HTTP or HTTPS”

using PHP Simple Check to your current url is http any type of Protocol and get to PHP if condition check.

How to get current page URL in PHP

Simple Answer: Use the simple PHP $_SERVER use the Superglobal Variable

Example

I hope you have Got What is How To Check URL Protocol Is https by PHP And how it works.I would Like to have FeadBack From My Blog(Pakainfo.com) readers.Your Valuable FeadBack,Any Question,or any Comments abaout This Article(Pakainfo.com) Are Most Always Welcome.

PHP Laravel carbon convert String To Date 0

PHP Laravel carbon convert String To Date

Today, We want to share with you PHP Laravel carbon convert String To Date.In this post we will show you Convert String To Carbon Instance, hear for PHP Convert dateTime come from mysql to date in laravel we will give you demo and example for implement.In this post, we will learn about Parses a time string according to a specified format with an example.

PHP Laravel carbon convert String To Date

There are the Following The simple About PHP Laravel carbon convert String To Date Full Information With Example and source code.

As I will cover this Post with live Working example to develop carbon difference between two times, so the install carbon laravel for this example is following below.

Convert String to Carbon Example

$date = Carbon\Carbon::parse($getDbDate);
dd($date);

Laravel Date Fromat

$date->diffForHumans();

$date->format('Y');
dd($date);

Fetch a Specific Date/Time using PHP Laravel

// fetch the current time  - 2018-12-19 10:10:54
//Carbon - A simple PHP API extension for DateTime
$livecurrent = Carbon::now();
$livecurrent = new Carbon();
dd($livecurrent);

// fetch today - 2018-12-19 00:00:00
$today = Carbon::today();
dd($today);

// fetch yesterday - 2018-12-18 00:00:00
$yesterday = Carbon::yesterday();
dd($yesterday);

// fetch tomorrow - 2018-12-20 00:00:00
$tomorrow = Carbon::tomorrow();
dd($tomorrow);

// convert a specific string - 2019-01-01 00:00:00
//carbon convert date to timestamp
$newYear = new Carbon('first day of January 2019');
dd($newYear);

// set a specific timezone - 2019-01-01 00:00:00
//Easy PHP Dates and Times With Carbon
$newYearPST = new Carbon('first day of January 2019', 'America\Pacific');
dd($newYearPST);

Angular 6 CRUD Operations Application Tutorials

Read :

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about PHP Laravel carbon convert String To Date.
I would like to have feedback on my Pakainfo.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

How to Insert Data in Database using PHP OOPS 0

How to Insert Data in Database using PHP OOPS

How to Insert Data in Database using PHP OOPS

In this Post We Will Explain About is How to Insert Data in Database using PHP OOPS With Example and Demo.Welcome on Pakainfo.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to how to fetch data from database in php using oops Example

In this post we will show you Best way to implement php mysql insert operation in PHP using OOP, hear for insert data in mysql using php class with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

Setp 1.First create a html form

Index.php

	<form name="insert" action="" method="post">
       <table width="100%" border="0">
  <tr>
    <th width="26%" height="50" scope="row users">USER Full Name :</th>
    <td width="74%"></td>
  </tr>
  <tr>
    <th height="50" scope="row users">USER Email :</th>
    <td></td>
  </tr>
  <tr>
    <th height="50" scope="row users">USER Contact no. :</th>
    <td></td>
  </tr>
  <tr>
    <th height="50" scope="row users">USER Gender :</th>
    <td> Male   
	 Female</td>
  </tr>
   <tr>
    <th height="50" scope="row users">USER Education :</th>
    <td>
	Select Any one
	10th
	12th
	Graduate
	Post Graduate
	 </td>
  </tr>
  <tr>
    <th height="50" scope="row users">USER Address :</th>
    <td><textarea name="user_address" class="form-control">
	</textarea></td>
  </tr>
  <tr>
    <th height="50" scope="row users"> </th>
    <td></td>
  </tr>
</table>
 
     </form>

Setp 2. Create a database with name demos

Inside demos content data base make a table inserdata
Sample some Structure of user_mst table

CREATE TABLE IF NOT EXISTS `user_mst` (
`id` int(11) NOT NULL,
`name` varchar(255) NOT NULL,
`email` varchar(255) NOT NULL,
`phone` bigint(20) NOT NULL,
`user_gender` varchar(255) NOT NULL,
`user_edu` varchar(255) NOT NULL,
`user_user_address` longtext NOT NULL,
`posting_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;

Setp 3. Create a php page function .php

Inside this simple page a using class DB_concreate or define. Db_con class contain simple database connection and some insert funtion.

function .php

Setp 4.Define a oject and class the insert funtion

Put this source code at the top of the simple root file index.php page

insert($user_fname,$email,$user_mobile,$user_gender,$user_edu,$adrss);
	if($sql)
	{
	echo "alert('USER Data inserted');";
	}
	else
	{
	echo "alert('USER Data not inserted');";
	}
}
 ?>

Example

I hope you have Got What is Objects Orientation in PHP And how it works.I would Like to have FeadBack From My Blog(Pakainfo.com) readers.Your Valuable FeadBack,Any Question,or any Comments abaout This Article(Pakainfo.com) Are Most Always Welcome.