Topic: Programming

ANGULARJS PHP MySQL Inline CRUD Example Tutorial From Scratch 0

ANGULARJS PHP MySQL Inline CRUD Example Tutorial From Scratch

Today, We want to share with you ANGULARJS PHP MySQL Inline CRUD Example Tutorial From Scratch.In this post we will show you AngularJS Inline CRUD with PHP, hear for Inline Table Add Edit Delete using AngularJS in PHP Mysql we will give you demo and example for implement.In this post, we will learn about AngularJS Inline CRUD Example Using PHP MySQLi Database with an example.

ANGULARJS PHP MySQL Inline CRUD Example Tutorial From Scratch

There are the Following The simple About ANGULARJS PHP MySQL Inline CRUD Example Tutorial From Scratch Full Information With Example and source code.

As I will cover this Post with live Working example to develop AngularJS Inline CRUD operation using PHP & MySQL, so the some major files and Directory structures for this example is following below.

  • index.php
  • select.php
  • insert.php
  • edit.php
  • delete.php

Step 1: Creating The Database connection

db_config.php

Step 2: AngularJS PHP Create, Read, Update, Delete

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>ANGULARJS PHP MySQL Inline CRUD Example Tutorial From Scratch</title>  
          
          
      
      
        <div class="pakainfo container">  
   <br />
            <h3 align="center">ANGULARJS PHP MySQL Inline CRUD Example Tutorial From Scratch</h3><br />
   <div class="table-responsive pakainfo">
                <div class="pakainfo alert alert-success alert-dismissible">
                    <a href="#" class="close">×</a>
                    {{memMsgSuccess}}
                </div>
                <form name="testform">
                    <table class="table table-bordered table-striped">
                        <thead>
                            <tr>
                                <th>Member Name</th>
                                <th>Last Name</th>
                                <th>Action</th>
                            </tr>
                        </thead>
                        <tbody>
                            <tr>
                                <td></td>
                                <td></td>
                                <td><button type="submit" class="btn btn-success btn-sm">Add</button></td>
                            </tr>
                            <tr>
                            </tr>
                            
                        </tbody>
                    </table>
                </form>
                
                    <td>{{data.member_fname}}</td>
                    <td>{{data.member_lname}}</td>
                    <td>
                        <button type="button" class="btn btn-primary btn-sm">Edit</button>
                        <button type="button" class="btn btn-danger btn-sm">Delete</button>
                    </td>
                
                
                    <td></td>
                    <td></td>
                    <td>
                        
                        <button type="button" class="btn btn-info btn-sm">Save</button>
                        <button type="button" class="btn btn-default btn-sm">Cancel</button>
                    </td>
                         
   </div>  
  </div>
      
  

var app = angular.module('liveApp', []);

app.controller('liveController', function($scope, $http){

    $scope.memberData = {};
    $scope.addData = {};
    $scope.success = false;

    $scope.addDatatemplate = function(data){
        if (data.id === $scope.memberData.id)
        {
            return 'edit';
        }
        else
        {
            return 'display';
        }
    };

    $scope.getMemData = function(){
        $http.get('select.php').success(function(data){
            $scope.memberNames = data;
        });
    };

    $scope.insertData = function(){
        $http({
            method:"POST",
            url:"insert.php",
            data:$scope.addData,
        }).success(function(data){
            $scope.success = true;
            $scope.memMsgSuccess = data.status;
            $scope.getMemData();
            $scope.addData = {};
        });
    };

    $scope.showEdit = function(data) {
        $scope.memberData = angular.copy(data);
    };

    $scope.editData = function(){
        $http({
            method:"POST",
            url:"edit.php",
            data:$scope.memberData,
        }).success(function(data){
            $scope.success = true;
            $scope.memMsgSuccess = data.status;
            $scope.getMemData();
            $scope.memberData = {};
        });
    };

    $scope.reset = function(){
        $scope.memberData = {};
    };

    $scope.closeMsg = function(){
        $scope.success = false;
    };

    $scope.deleteData = function(id){
        if(confirm("Are you sure you want to remove it?"))
        {
            $http({
                method:"POST",
                url:"delete.php",
                data:{'id':id}
            }).success(function(data){
                $scope.success = true;
                $scope.memMsgSuccess = data.status;
                $scope.getMemData();
            }); 
        }
    };

});


Step 3: ANGULARJS PHP MySQL Select Data

select.php

prepare($query);
if($statement->execute())
{
  while($row = $statement->fetch(PDO::FETCH_ASSOC))
  {
    $data[] = $row;
  }
  echo json_encode($data);
}

?>

Step 4: AngularJS Smart Table with Add Records

insert.php

 $mem_data_retrive->member_fname,
 ':member_lname'  => $mem_data_retrive->member_lname
);

$query = "
 INSERT INTO member_table 
 (member_fname, member_lname) VALUES 
 (:member_fname, :member_lname)
";

$statement = $connect->prepare($query);

if($statement->execute($data))
{
 $status = 'Data Inserted';
}

$output = array(
 'status' => $status
);

echo json_encode($output);

?>

Step 5: AngularJS Smart Table with Edit and Delete Records

edit.php

 $mem_data_retrive->member_fname,
 ':member_lname'  => $mem_data_retrive->member_lname,
 ':id'    => $mem_data_retrive->id
);

$query = "
 UPDATE member_table 
 SET member_fname = :member_fname, member_lname = :member_lname 
 WHERE id = :id
";

$statement = $connect->prepare($query);
if($statement->execute($data))
{
 $status = 'Data Edited';
}

$output = array(
 'status' => $status
);

echo json_encode($output);

?>

delete.php

id."'";

$statement = $connect->prepare($query);
if($statement->execute())
{
 $status = 'Data Deleted';
}

$output = array(
 'status' => $status
);

echo json_encode($output);

?>

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 ANGULARJS PHP MySQL Inline CRUD Example Tutorial From Scratch.
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 File Contents Data Scraping Example 0

PHP GET File Contents Data Scraping Example

Today, We want to share with you PHP GET File Contents Data Scraping.In this post we will show you web scrapers, hear for web scraping php tutorial we will give you demo and example for implement.In this post, we will learn about php web scraping library with an example.

PHP GET File Contents Data Scraping

There are the Following The simple About PHP GET File Contents Data Scraping Full Information With Example and source code for scrape content from website php or other way to web scraping php using php web scraping library.

Creating The Interface

<bindex.php


	
	<title>PHP Fetch File Contents Data Scraping</title>
		
		
	

	<nav class="navbar navbar-default">
		<div class="container-fluid">
			<a class="navbar-brand" href="https://pakainfo.com">pakainfo</a>
</a>		</div>
	</nav>
	<div class="col-md-3"></div>
	<div class="col-md-6 well">
		<h3 class="text-success">PHP Read File Contents Data Scraping</h3>
		<hr style="border-top:2px dotted #ccc" />
 
		<div class="pakainfo col-md-3"></div>
		<div class="pakainfo col-md-6">
			<form method="POST">
				<div class="form-group">
					<label>web scrapers URL:</label>
					
					<br />
					<button class="btn btn-success form-control" name="save">web scrapers - Get Data</button>
				</div>
			</form>
			<div></div>
		</div>	
	</div>


get_data.php

how to scrape data from a web page using PHP

<?php
	if(ISSET($_POST['save'])){
		$liveurl = $_POST['liveurl'];
		$data_content_scrapped = file_get_contents($liveurl);
		$alldata = explode('<nav id="navigation" role="navigation">', $data_content_scrapped);
		$lastend = explode('</nav>',  $alldata[1]);
		echo $lastend[0];
	}
?>	

Multiple Image Upload in php with Database

Read :

Summary

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

I hope you get an idea about Php Page Scraping.
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.8 Features and Updates 0

Laravel 5.8 Features and Updates

laravel 5.8 install

Via Laravel Installer

composer global require laravel/installer

laravel 5.8 requirements

  • PHP >= 7.1.3
  • OpenSSL PHP
  • PDO PHP
  • XML PHP
  • Ctype PHP
  • JSON PHP
  • BCMath PHP
  • Mbstring PHP
  • Tokenizer PHP

Deprecated String and Array Helpers Functions

In my point of view to Latest new features in laravel 5.8, removing all the PHP string and array global methods in PHP Latest frameworks Like laravel 5.8 laravel 5.8 github. we can not use any more methods like as a PHP array_add, or array_first, php functions Like array_last, str_slug, str_random or more…., instead of this methods we can use same Laravel latest included method using Illuminate\Support\Arr as well as Illuminate\Support\Str facade like as bellow example.

using Illuminate\Support\Arr or Illuminate\Support\Str facade

use Illuminate\Support\Arr;

$myArray = Arr::add(['name' => 'Admin'], 'total', 852);

// ['name' => 'Admin', 'total' => 852]

Example 2: Laravel 5.8 String Function

use Illuminate\Support\Str;

$random = Str::random(10);

Laravel 5.8 Added Blade Template File Path in Compiled file

As we know laravel 5.8 upgrade compile blade file, but as we can see your laravel 5.7 or laravel 5.6 Compiled blade files there are no file path of complied.

In laravel 5.8 they provide path of blade template file path as shown in example:

resources/views/welcome.blade.php

<?php /* /var/www/me/5.8/apps/resources/views/welcome.blade.php */ ?>
<!doctype html>
<html lang="<?php echo e(str_replace('_', '-', app()->getLocale())); ?>">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title>Laravel</title>
        <!-- Fonts -->
        <link href="https://fonts.googleapis.com/css?family=Nunito:200,600" rel="stylesheet">

Cache TTL in Seconds Change

Laravel 5.8 update cache time in ttl in minutes into seconds. so basically, We need to add time in seconds in put(), putMany(), add() as well as remember().

We can display bellow example to how to set time like as bellow example:

Cache::put('jk', 'jadavkaorat', now()->addSeconds(60));

Update Email Validation Rule

In this latest Laravel feature, laravel 5.8 updated email validation rule. laravel had already email validation, so in this server side input validation they latest Laravel update feature.

The users email validation check rule now data checks if the main email is like data RFC5630 compliant rules.

before if We include ‘[email protected]_name.com’ then it some data consider invalid but and then it consider valid.

Laravel 5.8 Added firstWhere in Collection

Laravel 5.8 added new simple function firstWhere() with data collection object. We can get single object using firstWhere method instead of first().

Simple Example for Laravel 5.8 firstWhere in MySQL

$collection = collect([
    ['name' => 'Hitesh', 'age' => 29],
    ['name' => 'Mayur', 'age' => 26],
    ['name' => 'Virat', 'age' => 23],
]);     
$collection->firstWhere('name', 'Mayur');

// ['name' => 'Mayur', 'age' => 26]

Unquoted MySQL JSON Values in Database

this laravel 5.8 feature for json datatype column main supported only. the any query MySQL builder will now return unquoted JSON Data values when using MySQL as well as MariaDB.display bellow example:

Example Laravel 5.8 Unquoted MySQL JSON Values

$data_value = DB::table('items')->value('details->language');

dump($data_value);

// Laravel 5.8...

'fr'

Calculate post read time using PHP Example 0

Calculate post read time using PHP

Today, We want to share with you Calculate post read time using PHP.In this post we will show you estimated reading time calculator, hear for wordpress reading time without plugin we will give you demo and example for implement.In this post, we will learn about how long does it take to read an article with an example.

Calculate post read time using PHP

There are the Following The simple About Calculate post read time using PHP Full Information With Example and source code.

As I will cover this Post with live Working example to develop article read time using PHP, so the some major estimated reading time php for this example is following below.

Estimated reading time in PHP

According to the web page tech or any, the average each post reading speed is between about 230-280 words per minute.

<?php
function getReadTime($allcontent = ''){
    $total_word = str_word_count(strip_tags($allcontent));
    $m = floor($total_word / 230);
    $s = floor($total_word % 230 / (230 / 60));
    $estimateTime = $m . ' minute' . ($m == 1 ? '' : 's') . ', ' . $s . ' second' . ($s == 1 ? '' : 's');

    return $estimateTime;
}

Example 2: Add Estimated Reading Time In Your WordPress Posts

Add the reading time of WordPress Post
functions.php

if (!function_exists('yhello_get_reading_time')):
	function yhello_get_reading_time($text){

		//PHP Round fractions up so the sample text post minimum read time is 1 minute
		$totalReadTm = ceil(str_word_count($text)/200);
		if ($totalReadTm == 1){
			$totalReadTm = $totalReadTm . ' minute read';
		}else{
			$totalReadTm = $totalReadTm . ' minutes read';
		}
		return $totalReadTm;
	}
endif;

simple blog template

<div class="read-time">
      <?php echo yhello_get_reading_time(get_the_content()); ?>
</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 Calculate post read time using PHP.
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.

Create time slot using PHP Example 0

Create time slot using PHP Example

Today, We want to share with you Create time slot using PHP Example.In this post we will show you how to make time slot in php, hear for time slot booking calendar php download we will give you demo and example for implement.In this post, we will learn about split time slots between start time and end time in php with an example.

Create time slot using PHP Example

There are the Following The simple About Create time slot using PHP Example Full Information With Example and source code.

As I will cover this Post with live Working example to develop how to create time slot in html, so the some major time slots available php for this example is following below.

PHP calendar with time slots

Split time slots between start time and end time in PHP

Create PHP slot time for 15 minutes sample from 10 Am to 2 Pm you can use this PHP source code

// getTimeSlot(IntervalInMinutes, $startTime, $endTime)
function getTimeSlot($sometimeOut, $start, $end)
{
    $start = new DateTime($start);
    $end = new DateTime($end);
    $BeginTimeStemp = $start->format('H:i'); // Get time Format in Hour and minutes
    $lastTimeStemp = $end->format('H:i');
    $i=0;
    while(strtotime($BeginTimeStemp) <= strtotime($lastTimeStemp)){
        $start = $BeginTimeStemp;
        $end = date('H:i',strtotime('+'.$sometimeOut.' minutes',strtotime($BeginTimeStemp)));
        $BeginTimeStemp = date('H:i',strtotime('+'.$sometimeOut.' minutes',strtotime($BeginTimeStemp)));
        $i++;
        if(strtotime($BeginTimeStemp) <= strtotime($lastTimeStemp)){
            $time[$i]['start'] = $start;
            $time[$i]['end'] = $end;
        }
    }
    return $time;
}
$slot = getTimeSlot(15, '10:00', '13:00');

echo "<pre>";
print_r($slot);

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 Create time slot using 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.