fordev22.com
  • Home
  • สอนทำระบบ POS (Point of Sale)
  • Flutter สำหรับผู้เริ่มต้น
  • PHP+MySqli
  • เนื้อหาอื่น ๆ
    • สอน Bootstrap 5
    • Dreamweaver+Bootstrap+PHP
    • Dreamweaver
    • Computer Tip
  • ABOUT US
    • Personal information
    • บริการ
    • ผลงาน
    • ตัวอย่าง ผลงานด้านการสอน (สอนสดผ่าน Google Meet, Zoom)
  • Search

(2023) PHP+MySqli EP.41 How to AJAX CrudPHP MySqli (Part 1 insert AND view)

April 19, 2023/in PHP+MySqli /by fordev22

(2023) PHP+MySqli EP.41
How to AJAX CrudPHP MySqli
(Part 1 insert AND view)

 

 

 


ระบบบริหารจัดการ ศูนย์ซ่อมรถยนต์ Car Service System ( PHP 7++ ขึ้นไป )

 

ตัวอย่างผลงาน FD22 Logistic 2020 ระบบบริหารจัดการขนส่ง

ระบบ บริหารจัดการร้านกาแฟ PHP | FD22-Cafe (Coffee AND Bakery)

CART&POS (ระบบจัดการงานขายหน้าร้านและ ออนไลน์ สำหรับร้านค้าขนาดกลาง,SME

เว็บไซต์ จองคิวทำเล็บ MANICURE SYSTEM ( PHP 7++ ขึ้นไป )

(2023) PHP+MySqli EP.40 How to Backup MySQL Database using PHP

SQL

1
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
-- phpMyAdmin SQL Dump
-- PHP Version: 7.2.34
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
-- Database: `ajax_db`
CREATE DATABASE IF NOT EXISTS `ajax_db` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
USE `ajax_db`;
-- --------------------------------------------------------
-- Table structure for table `crud`
 
CREATE TABLE `crud` (
  `id` int(11) NOT NULL,
  `name` varchar(100) CHARACTER SET utf8 NOT NULL,
  `email` varchar(100) CHARACTER SET utf8 NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
 
-- Dumping data for table `crud`
 
INSERT INTO `crud` (`id`, `name`, `email`) VALUES
(1, 'fordev22.com', 'fordev22@fordev22.com'),
(2, 'fordev22_2.com', 'fordev22_2@fordev22_2.com');
--
-- Indexes for table `crud`
--
ALTER TABLE `crud`
  ADD PRIMARY KEY (`id`);
-- AUTO_INCREMENT for dumped tables
-- AUTO_INCREMENT for table `crud`
--
ALTER TABLE `crud`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=19;
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 */;

database.php

1
2
3
4
5
6
7
8
9
10
11
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "ajax_db";
$conn = mysqli_connect($servername, $username, $password, $dbname);
mysqli_query($conn,"SET NAMES UTF8");
if (!$conn) {
    die("Connection failed: " . mysqli_connect_error());
}
?>

ajax_view.php

1
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<?php
include 'database.php';
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>User Data</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto|Varela+Round">
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<!-- <link rel="stylesheet" href="css/style.css"> -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="ajax_crud.js"></script>
</head>
<body>
<div class="container">
<p id="success"></p>
<div class="table-wrapper">
<div class="table-title">
<div class="row">
<div class="col-sm-8">
<h2> Ajex CRUD By fordev22.com</h2>
</div>
<div class="col-sm-4">
<a href="#addEmployeeModal" class="btn btn-success" data-toggle="modal"><i class="material-icons"></i> <span>Add New User</span></a>
</div>
</div>
</div>
<table class="table table-striped table-hover">
<thead>
<tr>
<th>SL NO</th>
<th>NAME</th>
<th>EMAIL</th>
<th>ACTION</th>
</tr>
</thead>
<tbody>
<?php
$result = mysqli_query($conn,"SELECT * FROM crud");
$i=1;
while($row = mysqli_fetch_array($result)) {
?>
<tr id="<?php echo $row["id"]; ?>">
<td><?php echo $i; ?></td>
<td><?php echo $row["name"]; ?></td>
<td><?php echo $row["email"]; ?></td>
<td>
</td>
</tr>
<?php
$i++;
}
?>
</tbody>
</table>
</div>
</div>
<!-- Add Modal HTML -->
<div id="addEmployeeModal" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<form id="user_form">
<div class="modal-header">
<h4 class="modal-title">Add User</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<div class="form-group">
<label>NAME</label>
<input type="text" id="name" name="name" class="form-control" required>
</div>
<div class="form-group">
<label>EMAIL</label>
<input type="email" id="email" name="email" class="form-control" required>
</div>
</div>
<div class="modal-footer">
<input type="hidden" value="1" name="type">
<input type="button" class="btn btn-default" data-dismiss="modal" value="Cancel">
<button type="button" class="btn btn-success" id="btn-add">Add</button>
</div>
</form>
</div>
</div>
</div>
 
 
</body>
</html>

ajax_crud.js

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
$(document).on('click','#btn-add',function(e) {
var data = $("#user_form").serialize();
$.ajax({
data: data,
type: "post",
url: "save_db.php",
success: function(dataResult){
var dataResult = JSON.parse(dataResult);
if(dataResult.statusCode==200){
$('#addEmployeeModal').modal('hide');
alert('Data added successfully !');
                        location.reload();
}
else if(dataResult.statusCode==201){
   alert(dataResult);
}
}
});
});

save_db.php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
include 'database.php';
if(count($_POST)>0){
if($_POST['type']==1){
$name=$_POST['name'];
$email=$_POST['email'];
$sql = "INSERT INTO `crud`( `name`, `email`)
VALUES ('$name','$email')";
if (mysqli_query($conn, $sql)) {
echo json_encode(array("statusCode"=>200));
}
else {
echo "Error: " . $sql . "<br>" . mysqli_error($conn);
}
mysqli_close($conn);
}
}
?>

 

 

Facebook
Twitter
Line
Tags: php, php+sqli php+sqli, Point of Sale Point of SalePOS POS, POS System POS System, ฟรีโปรเจคนักศึกษา, ฟอร์ม php, รับพัฒนาระบบ รับพัฒนาระบบ, รับเขียนโปรแกรม รับเขียนโปรแกรม, สอน bootstrap, สอน php, สอน php mysql, สอน php mysqli, สอน php พื้นฐาน, สอน php เบื้องต้น, สอนทำเว็บ, สอนทำเว็บ สอนทำเว็บ, สอนพัฒนาระบบ สอนพัฒนาระบบ, สอนเขียนเว็บ, สอนเขียนเว็บ สอนเขียนเว็บ, สอนเขียนโปรแกรม สอนเขียนโปรแกรม, เขียนโปรแกรมราคาถูก เขียนโปรแกรมราคาถูก, แจกระบบ php, แจกโคด php, โปรเจคคอมธุ, โปรเจคคอมพิวเตอร์, โปรเจคคอมพิวเตอร์ธุรกิจ, โปรเจคจบ คอมพิวเตอร์, โปรเจคนักศึกษา, โปรเจควิทยาการคอม Share this entry
Share this entry
  • Share on Facebook
  • Share on Twitter
  • Share on Google+
  • Share on Pinterest
  • Share on Linkedin
  • Share on Tumblr
  • Share on Vk
  • Share on Reddit
  • Share by Mail
https://fordev22.com/wp-content/uploads/2023/04/aj1.jpg 720 1280 fordev22 https://fordev22.com/wp-content/uploads/2018/08/logo_fordev22_2.png fordev222023-04-19 16:07:382023-04-19 17:31:13(2023) PHP+MySqli EP.41 How to AJAX CrudPHP MySqli (Part 1 insert AND view)
You might also like
สอนทำระบบ POS (ระบบขายหน้าร้าน) Ep 41. การนำ QR-Code มาใช้งาน
Bootstrap EP.7 การ include file ในการทำเว็บในแต่ละหน้า
Dreamweaver EP.12 การเพิ่มสินค้า,ประเภทสินค้าและเรียกแสดงสินค้าจากประเภท
สอนทำระบบ POS (ระบบขายหน้าร้าน) Ep 15. ลบข้อมูลจาก ID ที่ส่งมาออกจาก Database (จัดการสมาชิก Part 6)
Bootstrap EP.5 การใส่ Logo บน Navbar ในการทำเว็บไซต์
สอนทำระบบ POS (ระบบขายหน้าร้าน) Ep 39. สร้างไฟล์ เพื่อแสดงตัวเลขเป็นภาษาไทย(บันทึกการสั่งซื้อ Part 11)
สอนทำระบบ POS (ระบบขายหน้าร้าน) Ep 34. จัดการ ‎Transaction BEGIN, COMMIT, ROLLBACK(บันทึกการสั่งซื้อ Part 6)
สอนทำระบบ POS (ระบบขายหน้าร้าน) Ep 3. ดาวน์โหลด ไฟล์ ที่เกี่ยวข้อง ที่จะใช้พัฒนาระบบ

บริการและผลงาน

  • Home
  • Personal Information
  • คอสเรียนที่เปิดอยู่
  • ตัวอย่าง ผลงานด้านการสอน (สอนสดผ่าน Google Meet, Zoom)
  • บริการ
  • ผลงาน

ช่องทางการติดต่อ

Tel. 090-959-1107

ID Line. fordza4you

E-mail. fordza4you@gmail.com


รับพัฒนาระบบ
รับพัฒนาเว็บแอพพลิเคชั่น
รับพัฒนาเว็บไซต์

Page

Popular
  • สอน Flutter Ep 4. ติดตั้ง SDK Simulator...June 7, 2023 - 1:54 pm
  • Computer Tip EP.2 การปรับเสียง...October 13, 2016 - 10:13 pm
  • Dreamweaver EP.1 ลงโปรแกรมจำลอง...October 15, 2016 - 9:28 pm
  • Dreamweaver EP.2 สร้าง Database ด้วย ...October 16, 2016 - 12:48 pm
  • Dreamweaver EP.3 การสร้างที่เก็บเว็บไซต์และสร้าง...October 16, 2016 - 6:33 pm
Recent
  • สอน Flutter Ep 4. ติดตั้ง SDK Simulator...June 7, 2023 - 1:54 pm
  • สอน Flutter Ep 3. ติดตั้ง Xcode เพื่อใช้...June 7, 2023 - 1:49 pm
  • สอน Flutter Ep 2. วิธีติดตั้ง...June 7, 2023 - 1:16 pm
  • สอน Flutter Ep 1. วิธีติดตั้ง...June 7, 2023 - 10:52 am
  • (2023) PHP+MySqli EP.43 How to AJAX CrudPHP MySqli (Part...April 21, 2023 - 6:15 pm
Comments
  • sssssMay 4, 2017 - 11:52 am by fordev22
  • sssssMay 4, 2017 - 11:50 am by fordev22
  • Awaiting BACS payment Order status changed from Pending...March 1, 2017 - 9:23 am by WooCommerce
Tags
Bootstrap Database Datatable Datatable Serverside Dreamweaver Edit Sqli Mysqli php php+sqli php+sqli php+sqli Point of Sale Point of SalePOS POS POS System POS System showe Sqli sqli xampp กับ dreamweaver ฟรีโปรเจคนักศึกษา ฟอร์ม php รับพัฒนาระบบ รับพัฒนาระบบ รับเขียนโปรแกรม รับเขียนโปรแกรม ลบข้อมูล สร้าง Database สอน bootstrap สอน php สอน php mysql สอน php mysqli สอน php พื้นฐาน สอน php เบื้องต้น สอนทำเว็บ สอนทำเว็บ สอนทำเว็บ สอนพัฒนาระบบ สอนพัฒนาระบบ สอนเขียนเว็บ สอนเขียนเว็บ สอนเขียนเว็บ สอนเขียนโปรแกรม สอนเขียนโปรแกรม เขียนโปรแกรมราคาถูก เขียนโปรแกรมราคาถูก เพิ่มข้อมูล เพิ่มรูป แจกระบบ php แจกโคด php โปรเจคคอมธุ โปรเจคคอมพิวเตอร์ โปรเจคคอมพิวเตอร์ธุรกิจ โปรเจคจบ คอมพิวเตอร์ โปรเจคนักศึกษา โปรเจควิทยาการคอม โปรเจควิทยาการคอม Share this entry

Copyright@2018.fordev22.com

(2023) PHP+MySqli EP.40 How to Backup MySQL Database using PHP (2023) PHP+MySqli EP.42 How to AJAX CrudPHP MySqli (Part 2 Update)
Scroll to top