-
Notifications
You must be signed in to change notification settings - Fork 0
/
junk.php
40 lines (38 loc) · 1.21 KB
/
junk.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
$ro2 = mysqli_fetch_assoc($res1);
$ro1= mysqli_fetch_assoc($res);
//sales
if (isset($_POST['sale'])) {
$quer = "SELECT usersId FROM users WHERE usersName ='$name'";
$res = mysqli_query($db, $quer);
$ro1= mysqli_fetch_array($res);
$quer1 = "SELECT pid FROM products WHERE code='T1'";
$res1 = mysqli_query($db, $quer1);
$ro2 = mysqli_fetch_array($res1);
$sql1 = "INSERT INTO userprod (usersId,pid) VALUES ('$ro1[0]','$ro2[0]')";
mysqli_query($db, $sql1);
}
//sale data
if (isset($_POST['sale'])) {
$userid = '$name';
$pid = '1';}
$quer = "INSERT INTO userprod (usersId,pid) VALUES('$userid','$pid')";
mysqli_query($db, $quer);
if (isset($_POST['sale'])) {
$quer = "SELECT usersId FROM users WHERE usersName ='$name'";
$res = mysqli_query($db, $quer);
$ro1= mysqli_fetch_array($res);
if ($ro1 > 0) {
$sq = "INSERT INTO userprod (usersId) VALUES ('$ro1[0]')";
mysqli_query($db, $sq);
} else{
echo "no";
}
$quer1 = "SELECT pid FROM products WHERE code='T1'";
$res1 = mysqli_query($db, $quer1);
$ro2 = mysqli_fetch_array($res1);
if ($ro2 > 0) {
$sq1 = "INSERT INTO userprod (pid) VALUES ('$ro2[0]')";
mysqli_query($db, $sq1);
} else{
echo "no";
}