-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate.php
34 lines (22 loc) · 1.08 KB
/
update.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
<?php
session_start();
$list = $_POST['list'];
$thewords = json_decode(stripslashes($_POST['thewords']));
$thecnt = json_decode(stripslashes($_POST['thecnt']));
include_once 'sqlhost.php';
$mysql = mysql_connect($hosting ,$username,$password);
// echo $list.$thewords[0][0]."#".$thecnt[0]."#";
mysql_query("use vocabulary", $mysql);
for($i=0;$i<count($thewords);$i++){
if($list == 0)
mysql_query("update ".$_SESSION['username']."__cet4 set mem = '$thecnt[$i]' where word = '{$thewords[$i][0]}'", $mysql);
// mysql_query("update ".$_SESSION['username']."__cet4 set mem =".$thecnt[$i]." where word = ".$thewords[$i][0], $mysql);
else if($list == 1)
mysql_query("update ".$_SESSION['username']."__cet6 set mem = '$thecnt[$i]' where word = '{$thewords[$i][0]}'", $mysql);
// mysql_query("update ".$_SESSION['username']."__cet6 set mem =".$thecnt[$i]." where word = ".$thewords[$i][0], $mysql);
else if($list == 2){
mysql_query("update ".$_SESSION['username']." set mem = '$thecnt[$i]' where word = '{$thewords[$i][0]}'", $mysql);
}
}
// echo "true";
?>