-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathcustomer.php
More file actions
41 lines (31 loc) · 902 Bytes
/
customer.php
File metadata and controls
41 lines (31 loc) · 902 Bytes
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
<?php
$mysqli = new mysqli("127.0.0.1", "root", "", "dbms");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$name=$_POST['name'];
$addr=$_POST['addr'];
if($stmt = $mysqli->prepare("INSERT INTO customer(name,mobileno) VALUES (?,?)")){
$stmt->bind_param("ss", $name, $addr);
$stmt->execute();
}
if ($stmt = $mysqli->prepare("SELECT id FROM customer WHERE name=? and mobileno=?")) {
/* bind parameters for markers */
$stmt->bind_param("ss", $name, $addr);
/* execute query */
$stmt->execute();
/* bind result variables */
$stmt->bind_result($id);
/* fetch value */
$stmt->fetch();
printf("%s registered your unique id is %d\n", $name, $id);
/* close statement */
$stmt->close();
}
?>
<br>
<div>
<font size="2">Go back <a href="customer.html">click here</a></font>
</div>