-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathques_database.php
executable file
·51 lines (42 loc) · 1.16 KB
/
ques_database.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
<?php
$qno = 5;
$ques = $_POST["ques"];
$opt1 = $_POST["opt1"];
$opt2 = $_POST["opt2"];
$opt3 = $_POST["opt3"];
$opt4 = $_POST["opt4"];
$ans = $_POST["ans"];
$marks = $_POST["marks"];
$neg_marks = $_POST["neg_marks"];
/*$name = $_FILES["file"]["name"];
$data = file_get_contents($_FILES["file"]["tmp_name"]);
$type = $_FILES["file"]["type"];*/
$con = mysqli_connect("localhost", "root", "","questions");
if( $con )
{
echo "connected successfully<br>";
}
else
{
echo "cannot connect";
die();
}
// mysqli_autocommit($con,FALSE);
//if(substr($type, 0, 5) == "image")
//{
//$query = "INSERT INTO ques VALUES('$qno','$ques', '$opt1', '$opt2', '$opt3', '$opt4', '$ans', '$marks', '$neg_marks', '','$name','$data')";
//mysqli_query($con,$query);
//echo $query;
//mysqli_commit($con);
//mysqli_close($con);
//}
//else
//{
echo "Image not valid";
$query = "INSERT INTO ques VALUES('$qno','$ques', '$opt1', '$opt2', '$opt3', '$opt4', '$ans', '$marks', '$neg_marks')";
echo $query;
mysqli_query($con,$query);
//mysqli_commit($con);
//mysqli_close($con);
//}
?>