Meerdere waarden uit database toevoegen aan sessie
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
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
<?php
error_reporting(E_ALL);
session_start();
$dbLink = mysql_connect("localhost","140802","warbutton");
mysql_select_db('140802');
$strSqlCode = "SELECT * FROM producten;";
$oResultaat = mysql_query($strSqlCode);
print ("<table width=950 border=0>");
print ("<tr>");
print ("<td>");
print ("<b>");
print "product_id";
print ("</td>");
print ("</b>");
print ("<td>");
print ("<b>");
print "bestel";
print ("</td>");
print ("</b>");
While ($row = mysql_fetch_array($oResultaat))
{
print ("<tr>");
print ("<td>");
print $row['product_id'];
print ("</td>");
print ("<td>");
print ("<a href='?bestel=$row[product_id]'><img src='images/cart.jpg' border='0'>");
print ("</td>");
} //while loop word afgesloten
print ("</tr>");
print ("</table>");
// begin winkelwagen
print ("<br>");
print ("<br>");
$naarwinkelwagen = $_GET['bestel'];
if ($naarwinkelwagen > 0){
print ("inhoud winkelwagen");
session_register ("naarwinkelwagen");
print ("<br>");
print $naarwinkelwagen;
}
else {
print ("uw winkelwagen is leeg");
// einde winkelwagen
}
?>
error_reporting(E_ALL);
session_start();
$dbLink = mysql_connect("localhost","140802","warbutton");
mysql_select_db('140802');
$strSqlCode = "SELECT * FROM producten;";
$oResultaat = mysql_query($strSqlCode);
print ("<table width=950 border=0>");
print ("<tr>");
print ("<td>");
print ("<b>");
print "product_id";
print ("</td>");
print ("</b>");
print ("<td>");
print ("<b>");
print "bestel";
print ("</td>");
print ("</b>");
While ($row = mysql_fetch_array($oResultaat))
{
print ("<tr>");
print ("<td>");
print $row['product_id'];
print ("</td>");
print ("<td>");
print ("<a href='?bestel=$row[product_id]'><img src='images/cart.jpg' border='0'>");
print ("</td>");
} //while loop word afgesloten
print ("</tr>");
print ("</table>");
// begin winkelwagen
print ("<br>");
print ("<br>");
$naarwinkelwagen = $_GET['bestel'];
if ($naarwinkelwagen > 0){
print ("inhoud winkelwagen");
session_register ("naarwinkelwagen");
print ("<br>");
print $naarwinkelwagen;
}
else {
print ("uw winkelwagen is leeg");
// einde winkelwagen
}
?>
Dus:
dus bestel is 1 voeg toe aan array
daarna bestel is 2 hoog array op met 1.
vandaar deze vraag.. :)