Datum omzetten in Dagnaam
Ik zou alles tussen je array-brackets tussen quotes plaatsen.
Omdat je dat niet selecteert?
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
<?php
$result = mysql_query(
"SELECT
DATE_FORMAT(datum1,'%W') AS day_date1,
DATE_FORMAT(datum2,'%W') AS day_date2,
DATE_FORMAT(datum3,'%W') AS day_date3,
DATE_FORMAT(datum4,'%W') AS day_date4,
DATE_FORMAT(datum5,'%W') AS day_date5
FROM registratiekaart
WHERE id = '" . mysql_real_escape_string($_GET['id'])."'"
);
?>
$result = mysql_query(
"SELECT
DATE_FORMAT(datum1,'%W') AS day_date1,
DATE_FORMAT(datum2,'%W') AS day_date2,
DATE_FORMAT(datum3,'%W') AS day_date3,
DATE_FORMAT(datum4,'%W') AS day_date4,
DATE_FORMAT(datum5,'%W') AS day_date5
FROM registratiekaart
WHERE id = '" . mysql_real_escape_string($_GET['id'])."'"
);
?>
Vind je ook niet ;-)?
Gewijzigd op 24/04/2017 21:38:17 door - Ariën -
Code (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
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
<?php
mysql_connect("localhost", "", "7");
mysql_select_db("");
$result = mysql_query("SELECT DATE_FORMAT(datum1,'%W') AS day_date1,
DATE_FORMAT(datum2,'%W') AS day_date2,
DATE_FORMAT(datum3,'%W') AS day_date3,
DATE_FORMAT(datum4,'%W') AS day_date4,
DATE_FORMAT(datum5,'%W') AS day_date5
FROM registratiekaart
WHERE id = '" . mysql_real_escape_string($_GET['id'])."'");
if($result === false) {
echo "Er is een fout opgetreden: ".mysql_error();
} else {
echo "<table>";
while($data = mysql_fetch_assoc($result)) {
echo "<tr>";
echo "<th colspan='8'> Paraafkaart werken in de studiewerkruimte </th>";
echo "</tr>";
echo "<tr>";
echo "<th colspan='8'>" . $data["voornaam"] . " " . $data["tussenvoegsel"] . " " . $data["achternaam"] . "</th>";
echo "</tr>";
echo "<tr>";
echo "<td> datum </td>";
echo "<td> lesuur </td>";
echo "<td> paraaf </td>";
echo "<td colspan='5'> opmerkingen </td>";
echo "</tr>";
echo "<tr>";
echo "<td>" . $data[day_date1]. "</td>";
echo "<td>" . $data["lesuur1"] . "</td>";
echo "<td> </td>";
echo "<td> </td>";
echo "</tr>";
echo "<tr>";
echo "<td>" . $data[day_date2] . "</td>";
echo "<td>" . $data["lesuur2"] . "</td>";
echo "<td> </td>";
echo "<td> </td>";
echo "</tr>";
echo "<tr>";
echo "<td>" . $data[day_date3] . "</td>";
echo "<td>" . $data["lesuur3"] . "</td>";
echo "<td> </td>";
echo "<td> </td>";
echo "</tr>";
echo "<tr>";
echo "<td>" . $data[day_date4] . "</td>";
echo "<td>" . $data["lesuur4"] . "</td>";
echo "<td> </td>";
echo "<td> </td>";
echo "</tr>";
echo "<tr>";
echo "<td>" . $data[day_date5] . "</td>";
echo "<td>" . $data[lesuur5] . "</td>";
echo "<td> </td>";
echo "<td> </td>";
echo "</tr>";
}
echo "</table>";
}
?>
mysql_connect("localhost", "", "7");
mysql_select_db("");
$result = mysql_query("SELECT DATE_FORMAT(datum1,'%W') AS day_date1,
DATE_FORMAT(datum2,'%W') AS day_date2,
DATE_FORMAT(datum3,'%W') AS day_date3,
DATE_FORMAT(datum4,'%W') AS day_date4,
DATE_FORMAT(datum5,'%W') AS day_date5
FROM registratiekaart
WHERE id = '" . mysql_real_escape_string($_GET['id'])."'");
if($result === false) {
echo "Er is een fout opgetreden: ".mysql_error();
} else {
echo "<table>";
while($data = mysql_fetch_assoc($result)) {
echo "<tr>";
echo "<th colspan='8'> Paraafkaart werken in de studiewerkruimte </th>";
echo "</tr>";
echo "<tr>";
echo "<th colspan='8'>" . $data["voornaam"] . " " . $data["tussenvoegsel"] . " " . $data["achternaam"] . "</th>";
echo "</tr>";
echo "<tr>";
echo "<td> datum </td>";
echo "<td> lesuur </td>";
echo "<td> paraaf </td>";
echo "<td colspan='5'> opmerkingen </td>";
echo "</tr>";
echo "<tr>";
echo "<td>" . $data[day_date1]. "</td>";
echo "<td>" . $data["lesuur1"] . "</td>";
echo "<td> </td>";
echo "<td> </td>";
echo "</tr>";
echo "<tr>";
echo "<td>" . $data[day_date2] . "</td>";
echo "<td>" . $data["lesuur2"] . "</td>";
echo "<td> </td>";
echo "<td> </td>";
echo "</tr>";
echo "<tr>";
echo "<td>" . $data[day_date3] . "</td>";
echo "<td>" . $data["lesuur3"] . "</td>";
echo "<td> </td>";
echo "<td> </td>";
echo "</tr>";
echo "<tr>";
echo "<td>" . $data[day_date4] . "</td>";
echo "<td>" . $data["lesuur4"] . "</td>";
echo "<td> </td>";
echo "<td> </td>";
echo "</tr>";
echo "<tr>";
echo "<td>" . $data[day_date5] . "</td>";
echo "<td>" . $data[lesuur5] . "</td>";
echo "<td> </td>";
echo "<td> </td>";
echo "</tr>";
}
echo "</table>";
}
?>
Klopt dat ik die gegevens van lesuur niet opvraag, domme vraag misschien maar hoe vraag ik een getal op uit een kolom met type int(5). Danku alvast
Gewijzigd op 24/04/2017 21:46:12 door Jaap den Dool
$data['veldnaam']
Ja dat snap ik, maar ik heb voor dit nog nooit zo met SELECT gewerkt. Ik kan niet opvragen met behulp van DATA_FORMAT, maar met wat dan?
gewoon, zonder.
https://www.mupload.nl/img/gndjneg1yfqtf.png
Script:
Code (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
71
72
73
74
75
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
71
72
73
74
75
<?php
mysql_connect("localhost", "", "");
mysql_select_db("");
$result = mysql_query("SELECT DATE_FORMAT(datum1,'%W') AS day_date1,
DATE_FORMAT(datum2,'%W') AS day_date2,
DATE_FORMAT(datum3,'%W') AS day_date3,
DATE_FORMAT(datum4,'%W') AS day_date4,
DATE_FORMAT(datum5,'%W') AS day_date5,
lesuur1,
lesuur2,
lesuur3,
lesuur4,
lesuur5,
voornaam,
tussenvoegsel,
achternaam
FROM registratiekaart
WHERE id = '" . mysql_real_escape_string($_GET['id'])."'");
if($result === false) {
echo "Er is een fout opgetreden: ".mysql_error();
} else {
echo "<table>";
while($data = mysql_fetch_assoc($result)) {
echo "<tr>";
echo "<th colspan='8'> Paraafkaart werken in de studiewerkruimte </th>";
echo "</tr>";
echo "<tr>";
echo "<th colspan='8'>" . $data["voornaam"] . " " . $data["tussenvoegsel"] . " " . $data["achternaam"] . "</th>";
echo "</tr>";
echo "<tr>";
echo "<td> datum </td>";
echo "<td> lesuur </td>";
echo "<td> paraaf </td>";
echo "<td colspan='5'> opmerkingen </td>";
echo "</tr>";
echo "<tr>";
echo "<td>" . $data["day_date1"]. "</td>";
echo "<td>" . $data["lesuur1"] . "</td>";
echo "<td> </td>";
echo "<td> </td>";
echo "</tr>";
echo "<tr>";
echo "<td>" . $data["day_date2"] . "</td>";
echo "<td>" . $data["lesuur2"] . "</td>";
echo "<td> </td>";
echo "<td> </td>";
echo "</tr>";
echo "<tr>";
echo "<td>" . $data["day_date3"] . "</td>";
echo "<td>" . $data["lesuur3"] . "</td>";
echo "<td> </td>";
echo "<td> </td>";
echo "</tr>";
echo "<tr>";
echo "<td>" . $data["day_date4"] . "</td>";
echo "<td>" . $data["lesuur4"] . "</td>";
echo "<td> </td>";
echo "<td> </td>";
echo "</tr>";
echo "<tr>";
echo "<td>" . $data["day_date5"] . "</td>";
echo "<td>" . $data["lesuur5"] . "</td>";
echo "<td> </td>";
echo "<td> </td>";
echo "</tr>";
}
echo "</table>";
}
?>
mysql_connect("localhost", "", "");
mysql_select_db("");
$result = mysql_query("SELECT DATE_FORMAT(datum1,'%W') AS day_date1,
DATE_FORMAT(datum2,'%W') AS day_date2,
DATE_FORMAT(datum3,'%W') AS day_date3,
DATE_FORMAT(datum4,'%W') AS day_date4,
DATE_FORMAT(datum5,'%W') AS day_date5,
lesuur1,
lesuur2,
lesuur3,
lesuur4,
lesuur5,
voornaam,
tussenvoegsel,
achternaam
FROM registratiekaart
WHERE id = '" . mysql_real_escape_string($_GET['id'])."'");
if($result === false) {
echo "Er is een fout opgetreden: ".mysql_error();
} else {
echo "<table>";
while($data = mysql_fetch_assoc($result)) {
echo "<tr>";
echo "<th colspan='8'> Paraafkaart werken in de studiewerkruimte </th>";
echo "</tr>";
echo "<tr>";
echo "<th colspan='8'>" . $data["voornaam"] . " " . $data["tussenvoegsel"] . " " . $data["achternaam"] . "</th>";
echo "</tr>";
echo "<tr>";
echo "<td> datum </td>";
echo "<td> lesuur </td>";
echo "<td> paraaf </td>";
echo "<td colspan='5'> opmerkingen </td>";
echo "</tr>";
echo "<tr>";
echo "<td>" . $data["day_date1"]. "</td>";
echo "<td>" . $data["lesuur1"] . "</td>";
echo "<td> </td>";
echo "<td> </td>";
echo "</tr>";
echo "<tr>";
echo "<td>" . $data["day_date2"] . "</td>";
echo "<td>" . $data["lesuur2"] . "</td>";
echo "<td> </td>";
echo "<td> </td>";
echo "</tr>";
echo "<tr>";
echo "<td>" . $data["day_date3"] . "</td>";
echo "<td>" . $data["lesuur3"] . "</td>";
echo "<td> </td>";
echo "<td> </td>";
echo "</tr>";
echo "<tr>";
echo "<td>" . $data["day_date4"] . "</td>";
echo "<td>" . $data["lesuur4"] . "</td>";
echo "<td> </td>";
echo "<td> </td>";
echo "</tr>";
echo "<tr>";
echo "<td>" . $data["day_date5"] . "</td>";
echo "<td>" . $data["lesuur5"] . "</td>";
echo "<td> </td>";
echo "<td> </td>";
echo "</tr>";
}
echo "</table>";
}
?>
Ik weet niet of het ook binnen Windows werkt. Ik zelf heb het nog niet aan de praat gekregen in het Nederlands. Op Linux werkt het prima!
Gewijzigd op 24/04/2017 22:09:34 door - Ariën -
Klasse Ariën, bedankt voor alles. Zonder jou was het niet mogelijk geweest. Held
Graag gedaan. En het is "zonder 'ons'" ;-)
het is nl_NL, niet NL_nl. Op Windows maakt het niet uit omdat het niet case sensitive is, maar op Linux ga je gigantisch hard op je bek als je dit niet goed aanpakt.
[/zeikmodus]
Ligt denk ik een beetje aan het OS welke je draait, vermoed ik.
Quote:
zeikmodus
Kunnen ze op phphulp hier geen officiële tag van maken
Ik lag bijna plat van het lachen.
Jan