Simple PHP JSON Web Service and MySQL

Database
-- phpMyAdmin SQL Dump
-- version 4.8.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Jan 22, 2019 at 03:40 PM
-- Server version: 10.1.34-MariaDB
-- PHP Version: 7.2.8

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `bdname`
--

-- --------------------------------------------------------

--
-- Table structure for table `table_refresh`
--

CREATE TABLE `table_refresh` (
  `uniqueid` int(11) NOT NULL,
  `firstname` text NOT NULL,
  `surname` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `table_refresh`
--

INSERT INTO `table_refresh` (`uniqueid`, `firstname`, `surname`) VALUES
(31, 'test', 'test2');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `table_refresh`
--
ALTER TABLE `table_refresh`
  ADD PRIMARY KEY (`uniqueid`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `table_refresh`
--
ALTER TABLE `table_refresh`
  MODIFY `uniqueid` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=32;
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;


Data.php

query($sql);
	$r=array();
	while($row = mysqli_fetch_array($result))
	{
		$r[] = $row;
	}
	echo json_encode($r);
	?>

getdata.php


id data2 data3

SIMPLE CRUD Database MySQL using PHP

Database

-- phpMyAdmin SQL Dump
-- version 4.8.2
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Jan 22, 2019 at 03:40 PM
-- Server version: 10.1.34-MariaDB
-- PHP Version: 7.2.8

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `bdname`
--

-- --------------------------------------------------------

--
-- Table structure for table `table_refresh`
--

CREATE TABLE `table_refresh` (
  `uniqueid` int(11) NOT NULL,
  `firstname` text NOT NULL,
  `surname` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `table_refresh`
--

INSERT INTO `table_refresh` (`uniqueid`, `firstname`, `surname`) VALUES
(31, 'test', 'test2');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `table_refresh`
--
ALTER TABLE `table_refresh`
  ADD PRIMARY KEY (`uniqueid`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `table_refresh`
--
ALTER TABLE `table_refresh`
  MODIFY `uniqueid` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=32;
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;


Insert.php



  
  PHP Crud sample 



  

Edit.php
query($sql);
	$row = mysqli_fetch_array($result);
?>




  
  PHP Crud sample 



  

Delete.php
query($sql);
?>

add new data query($sql); while($row = mysqli_fetch_array($result)) { //print data ?>
# Name Email Action
edit delete

Data.php
query($sql);
		if(!$result)
		{
			echo "Failed to insert record";
		}
		else
		{
			echo "Record inserted successfully";
		}
	}
	else{
		$id=$_POST['id'];
		$sql = "
			Update table_refresh
			SET
			firstname = '$name',
			surname = '$surname' where uniqueid=$id";
			$result = $conn->query($sql);
	}
}
?>

add new data query($sql); while($row = mysqli_fetch_array($result)) { //print data ?>
# Name Email Action
edit delete

Macro Excel For Copy Data To New Workbook And Auto Draft Email

Copy Data And Attachment to Email
Create New Excel Then Add Data like example below

Create new sheet for data to format email like below


Go to tab developer click visual basic

Create new module 
Copy and paste code in below


Sub CompileEmail()
 lastrow = Sheet1.Cells(Rows.Count, 1).End(xlUp).Row
'MsgBox lastrow
 'lastcolumn = Sheet3.Cells(1, Columns.Count).End(xlToLeft).Column
 Workbooks.Add
 j = 3
 For i = 1 To lastrow
    Range("A" & i).Value = Sheet1.Range("A" & j)
    j = j + 1
 Next
 

'Step 4 Turn off application alerts
    Application.DisplayAlerts = False
'Step 5 Save the newly created workbook
     a = "C:\Users\Public\Documents\Makro_Create_New_And_Email_" & Replace(Replace(Replace(Now, "/", "_"), " ", "_"), ":", "_") & ".xlsx"
     ActiveWorkbook.SaveAs _
     Filename:=a
'Step 6 Turn application alerts back on
    Application.DisplayAlerts = True
    
Dim OutlookApp As Outlook.Application
Dim MItem As Outlook.MailItem
Dim cell As Range
Dim Subj As String
Dim EmailAddr As String
Dim Recipient As String
Dim msg As String

'Create Outlook object
Set OutlookApp = New Outlook.Application


'condition the rows
If Sheet2.Range("B3").Value Like "*@*" Then
EmailAddr = "" & Sheet2.Range("B3")
End If
If Sheet2.Range("B4").Value Like "*@*" Then
EmailCC = "" & Sheet2.Range("B4")
End If
'add subject to message
Subj = "" & Sheet2.Range("B5")

'Compose message
msg = "" & Sheet2.Shapes("TextBox 1").TextFrame.Characters.Text


'Create Mail Item and view before sending
Set MItem = OutlookApp.CreateItem(olMailItem)
With MItem
.To = EmailAddr
.CC = EmailCC
.Subject = Subj
.Body = msg
.Display 'change to .send if you want to send it before review

'Attach File
.attachments.Add a
End With

End Sub

On the sheet1 add new button and assign macro name Compile Email()
here is the result




Demo Video

Algoritma Bayes

teori bayes
Implementasi Algoritma Bayes.
Algoritma Bayes atau lebih di kenal Bayesian merupakan algoritma yang menggunakan perhitungan probabilitas. untuk mengetahui tentang algoritma bayes lebih detail dan sejarahnya  dapat di lihat di wikipedia

Algoritma Eliminasi Gauss-Naif

persamaan linier merupakan persoalan yang biasa kita temukan dalam matematika. penyelesaian persamaan linier biasanya menggunakan proses subtitusi dan eliminasi. pada kesempatan kali ini saya mencoba berbagi penyelesaian persamaan linier menggunakan program yaitu menggunakan algoritma Eliminasi Gauss-Naif atau biasa disebut Eliminasi Gauss. pada operasi ini kita menggunakan matrik dalam prosesnya.

membuat binary tree menggunakan bahasa c

binary search tree merupakan sebuah metode pencarian menggunakan tree atau bentuk pohon. binary tree hanya dapat mengorganisasi hirarki dengan 2 child. implementasi binary tree dilakukan dengan mendefinisikan linked list, masing masing node terdiri dari 3 bagian yakni pointer kanan, data info, pointer kiri

Membuat Stack Menggunakan bahasa C

Stack atau tumpukan merupakan sebuah metode yang di gunakan untuk menimbun suatu nilai. stack menggunakan Last In First Out (LIFO). konsep ini melakukan penyimpanan dengan data yang pertama masuk akan keluar terakhir dan data yang terakhir masuk akan keluar pertama. ada dua istilah dalam stack yaitu push dan pop . push yaitu melakukan penyimpanan nilai sedangkan pop yaitu melakukan pengambilan nilai dari penyimpanan.