-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUpdation.php
59 lines (38 loc) · 1.05 KB
/
Updation.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
<?php
require('mysql.php');
$size = sizeof($_POST);
$record = $size/5; //number of column = 5 in book table
for ( $i = 1; $i <= $record; $i++ ) {
$index1 = "B_ID".$i;
$b_id[$i] = $_POST[$index1];
$index2 = "B_Title".$i;
$b_title[$i] = $_POST[$index2];
$index3 = "B_Price".$i;
$b_price[$i] = $_POST[$index3];
$index4 = "B_Auther".$i;
$b_auther[$i] = $_POST[$index4];
$index5 = "B_Addition".$i;
$b_addition[$i] = $_POST[$index5];
}
for ( $i = 1; $i <= $record; $i++ ) {
$q = "update Book Set B_Title = '$b_title[$i]', B_Price = $b_price[$i],
B_Auther = '$b_auther[$i]', B_Addition = '$b_addition[$i]' Where B_ID = $b_id[$i]";
//Keeping value of all columns or fields in there arrays
mysqli_query($conn, $q);
}
mysqli_close($conn);
?>
<!DOCTYPE html>
<html>
<head>
<title> Updation </title>
</head>
<body>
<h1> Book Record Management </h1>
<p> <?php
echo $size." Record Updated";
?>
</p>
Go Back to Home Page <a href="index.php">Click Here</a> <!-- Aunchor tag -->
</body>
</html>