-
Notifications
You must be signed in to change notification settings - Fork 0
/
intodb.php
70 lines (59 loc) · 1.2 KB
/
intodb.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
<?php
session_start();
if($_SESSION['SESS_MEMBER_ID']==NULL)
{
header('Location: login-form.php');
}
for($i=1;$i<=$_POST['length'];$i++)
{
if(isset($_POST[$i]))
{
echo $i;
}
}
$sender=$_SESSION['SESS_MEMBER_ID'];
$text=$_POST['text'];
$con=mysqli_connect("localhost","mohitkharb","ms_khatam","login");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$sql_halo = "INSERT INTO halo ".
"(sender , message) ".
"VALUES ".
"('$sender','$text')";
//for halo sql
$retval_insert = mysqli_query( $con ,$sql_halo);
if(! $retval_insert )
{
die('Could not enter data: ' . mysql_error());
}
$last_hid= "SELECT MAX(halo_id) FROM halo";
//for last id
$retval = mysqli_query( $con ,$last_hid);
if(! $retval )
{
die('Could not enter data: qq' . mysql_error());
}
// Highest id part
while($row = mysqli_fetch_array($retval))
{
echo "hi";
echo $row;
$value=0;
foreach($row as $val)
{
$value=$val;
}
}
for($i=1;$i<$_POST['length'];$i++)
{
if(isset($_POST[$i]))
{
mysqli_query($con, "insert into receivers (halo_id , receiver) values ($value , $i)");
}
}
echo "Success";
header('Location: myhalos.php');
?>