-
Notifications
You must be signed in to change notification settings - Fork 0
/
bdd.php
63 lines (62 loc) · 2.16 KB
/
bdd.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
<?php
include('include.php');
$table = 'user';
$users = $bdd->query("SELECT * FROM $table")->fetchAll();
$names = array('username', 'email', 'salt', 'password', 'confirmation_token', 'name', 'city');
foreach($users as $u)
foreach ($names as $name) {
$user2 = $bdd->prepare("UPDATE $table SET $name = ? WHERE id = ".$u['id']);
$user2->bindValue(1, utf8_encode($u[$name]), PDO::PARAM_STR);
$user2->execute();
}
echo "user<br/>";
$table = 'opponent';
$users = $bdd->query("SELECT * FROM $table")->fetchAll();
$names = array('name');
foreach($users as $u)
foreach ($names as $name) {
$user2 = $bdd->prepare("UPDATE $table SET $name = ? WHERE id = ".$u['id']);
$user2->bindValue(1, utf8_encode($u[$name]), PDO::PARAM_STR);
$user2->execute();
}
echo "opponent<br/>";
$table = 'news';
$users = $bdd->query("SELECT * FROM $table")->fetchAll();
$names = array('title', 'author', 'content');
foreach($users as $u)
foreach ($names as $name) {
$user2 = $bdd->prepare("UPDATE $table SET $name = ? WHERE id = ".$u['id']);
$user2->bindValue(1, utf8_encode($u[$name]), PDO::PARAM_STR);
$user2->execute();
}
echo "news<br/>";
$table = 'match2';
$users = $bdd->query("SELECT * FROM $table")->fetchAll();
$names = array('matchlink');
foreach($users as $u)
foreach ($names as $name) {
$user2 = $bdd->prepare("UPDATE $table SET $name = ? WHERE id = ".$u['id']);
$user2->bindValue(1, utf8_encode($u[$name]), PDO::PARAM_STR);
$user2->execute();
}
echo "match2<br/>";
$table = 'competition';
$users = $bdd->query("SELECT * FROM $table")->fetchAll();
$names = array('name');
foreach($users as $u)
foreach ($names as $name) {
$user2 = $bdd->prepare("UPDATE $table SET $name = ? WHERE id = ".$u['id']);
$user2->bindValue(1, utf8_encode($u[$name]), PDO::PARAM_STR);
$user2->execute();
}
echo "competition<br/>";
$table = 'game';
$users = $bdd->query("SELECT * FROM $table")->fetchAll();
$names = array('name');
foreach($users as $u)
foreach ($names as $name) {
$user2 = $bdd->prepare("UPDATE $table SET $name = ? WHERE id = ".$u['id']);
$user2->bindValue(1, utf8_encode($u[$name]), PDO::PARAM_STR);
$user2->execute();
}
echo "game<br/>";