-
Notifications
You must be signed in to change notification settings - Fork 0
/
49.php
40 lines (34 loc) · 803 Bytes
/
49.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
<?php
$db_host="localhost";
$db_user="root"
$db_password="";
$db_name="test_db";
$con=mysqli_connect($db_host,$db_user,$db_password,$db_name);
if (!$con)
{
die("Connection Failed".mysqli_connect_error());
}
echo "Connected";
if(isset($_REQUEST['insert']))
{
if($_REQUEST['id']==""||$_REQUEST['name']==""||$_REQUEST['roll']==""||$_REQUEST['address']==""||)
{echo "Fill ALL FIELD";}
else
{
$sql="INSERT INTO student(id,name,roll,address) VALUES(?,?,?,?)";
$result=mysqli_prepare($con,$sql);
if($result)
{
mysqli_stmt_bind_param($result,$id,$name,$roll,$address);
$id=$_REQUEST['id'];
$name=$_REQUEST['name'] ;
$roll=$_REQUEST['roll'];
$address=$_REQUEST['address'];
mysqli_stmt_execute($result);
mysqli_stmt_affected_rows($result);
}
}
}
else{echo"Can Not Insert";}
mysqli_stmt_close($result);
?>