PHP zoekfunctie in sql
Pagina: « vorige 1 2 3 4 5 volgende »
Kan je line 30 t/m line 35 ff posten, is wat makkelijker zoeken dan :)
searchpage 30 t/m 35
</blockquote></td>
</tr>
</table></td>
<td width="208" height="107" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
resultpage 30 tm 35
<!--DWLayoutTable-->
<tr>
<td height="81" colspan="5" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
ik denk niet dat je hiermee veel verder komt
En wat is de exacte foutmelding?
Dat is de foutmelding, maar ik ben dus op zoek naar regel 30 t/m 35 van de gebruikte PHP code. Wat je hier neer zet, lijkt nogal op de html code, maar daar zit de fout niet in, tenminste ik zie hem niet.
Misschien iemand anders?
Gewijzigd op 23/01/2006 15:02:00 door Robert Deiman
Ja het hele boekwerk:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Debitel Sales Tool - Hoofdpagina</title>
</head>
<body>
<body text="#668014">
<body link="#009ACD">
<body vlink="#556B2F">
<body alink="#009ACD">
<table width="1024" border="0" cellpadding="0" cellspacing="0">
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
$db = mysql_connect("localhost", "root");
interfoon_nl_db("mydb",$db);
<!--DWLayoutTable-->
<tr>
<td height="81" colspan="5" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="1024" height="81" background="images/ja.jpg"><div align="center">
<h1>Debitel Sales Tool</h1>
</div></td>
</tr>
</table></td>
</tr>
<tr>
<td width="192" rowspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="325" height="602" valign="top" background="images/Company-Boxed_SideBox.jpg"><blockquote>
<p> </p>
<p align="center">Hier vind je de laatste info!<br />
"info"</p>
</blockquote>
$result = mysql_query("SELECT * FROM products",$db);
echo "<table border=1>\n";
echo "<tr><td>merk</td><td>model</tr>\n";
while ($myrow = mysql_fetch_row($result)) {
printf("<tr><td>%s %s</td><td>%s</td></tr>\n",
$myrow[1], $myrow[2], $myrow[3]);
}
echo "</table>\n";
?>
$db = mysql_connect("localhost", "root");
interfoon_nl_db("mydb",$db);
<!--DWLayoutTable-->
<tr>
<td height="81" colspan="5" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="1024" height="81" background="images/ja.jpg"><div align="center">
<h1>Debitel Sales Tool</h1>
</div></td>
</tr>
</table></td>
</tr>
<tr>
<td width="192" rowspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="325" height="602" valign="top" background="images/Company-Boxed_SideBox.jpg"><blockquote>
<p> </p>
<p align="center">Hier vind je de laatste info!<br />
"info"</p>
</blockquote>
$result = mysql_query("SELECT * FROM products",$db);
echo "<table border=1>\n";
echo "<tr><td>merk</td><td>model</tr>\n";
while ($myrow = mysql_fetch_row($result)) {
printf("<tr><td>%s %s</td><td>%s</td></tr>\n",
$myrow[1], $myrow[2], $myrow[3]);
}
echo "</table>\n";
?>
</tr>
</table></td>
<td width="208" height="107" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="208" height="107" align="center" valign="middle" background="images/Company-Boxed_TobBox_01.jpg"><div align="center">
<h2><a href="index.html">Home</a></h2>
</div></td>
</tr>
</table></td>
<td width="208" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td color="#668014" width="208" height="107" align="center" valign="middle" background="images/Company-Boxed_TobBox_02.jpg"><div align="center">
<h2><a href="aanbiedingdoen.html">Aanbieding doen</a></h2>
</div></td>
</tr>
</table></td>
<td width="208" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="208" height="107" align="center" valign="middle" background="images/Company-Boxed_TobBox_03.jpg"><h2 align="center"><a href="Argumentatie.html">Argumentatie</a></h2
></td>
</tr>
</table></td>
<td width="208" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="208" height="107" align="center" valign="middle" background="images/Company-Boxed_TobBox_04.jpg"><div align="center">
<h2><a href="Toestelinfo.html">Toestel info</a></h2>
</div></td>
</tr>
</table></td>
</tr>
<tr>
<td height="495" colspan="4" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="832" height="495" align="center" valign="top" background="images/Company-Boxed_MainBox.jpg"><div align="center">
<p> </p>
<blockquote>
<p align="left"> </p>
<p align="left"><br />
</p>
<p align="left"></p>
<p align="left"> </p>
</blockquote>
</div></td>
</tr>
</table></td>
</tr>
<tr>
<td height="85" colspan="5" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="1024" height="85" align="center" valign="bottom" background="images/ja.jpg"><div align="center">
<h5>Copyright (c) 2006 <a href="mailto:[email protected]">Mike</a></h5>
</div></td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
interfoon_nl_db("mydb",$db);
?> <<-- Je had PHP niet afgesloten
Dat dus aanpassen, en dan moet je
<p align="center">Hier vind je de laatste info!<br />
"info"</p>
</blockquote>
// hier php nog weer openen
$result = mysql_query("SELECT * FROM products",$db);
Fatal error: Call to undefined function: interfoon_nl_db() in /data/members/free/tripod/nl/i/n/t/interfoon/htdocs/result.php on line 29
________________________________
Probeer het eens zo:
mysql_select_db("mydb",$db);
Gewijzigd op 23/01/2006 15:43:00 door Robert Deiman
echter laat hij de hele tabel zien en filtert niet op criteria
Je hebt nu staan (select * from tabel), dus dan selecteerd die ook alles.
SELECT veld1, veld2
FROM tabel
" . $voorwaarden;
// hierna je query uitvoeren
}
?>
Jah, dat deel en het deel waar die de voorwaarden maakt. Dat deel met al die if lussen enzo :)
maar hoe zorg ik ervoor dat ie dan op die criteria selecteerd?
SELECT merk, model, kort, prijs, link
FROM products
WHERE" . $voorwaarden;
// hierna je query uitvoeren
echo $sql;
}
?>
zou die het dan zo al niet moeten doen?
want hij werkt niet
hij laat dus de hele tabel zien ipv het gewenste resultaat
Wil je nu dan de hele code nog eens laten zien die je hebt? Dat is iets gemakkelijker kijken wat er niet goed gaat :)
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Debitel Sales Tool - Hoofdpagina</title>
</head>
<body>
<body text="#668014">
<body link="#009ACD">
<body vlink="#556B2F">
<body alink="#009ACD">
<table width="1024" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td height="81" colspan="5" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="1024" height="81" background="images/ja.jpg"><div align="center"> </div></td>
</tr>
</table></td>
</tr>
<tr>
<td width="192" rowspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="325" height="602" valign="top" background="images/Company-Boxed_SideBox.jpg"><blockquote>
<p> </p>
<p align="center">Hier vind je de laatste info!<br />
"info"</p>
</blockquote></td>
</tr>
</table></td>
<td width="208" height="107" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="208" height="107" align="center" valign="middle" background="images/Company-Boxed_TobBox_01.jpg"><div align="center">
<h2><a href="index.html">Home</a></h2>
</div></td>
</tr>
</table></td>
<td width="208" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td color="#668014" width="208" height="107" align="center" valign="middle" background="images/Company-Boxed_TobBox_02.jpg"><div align="center">
<h2><a href="aanbiedingdoen.html">Aanbieding doen</a></h2>
</div></td>
</tr>
</table></td>
<td width="208" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="208" height="107" align="center" valign="middle" background="images/Company-Boxed_TobBox_03.jpg"><h2 align="center"><a href="Argumentatie.html">Argumentatie</a></h2
></td>
</tr>
</table></td>
<td width="208" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="208" height="107" align="center" valign="middle" background="images/Company-Boxed_TobBox_04.jpg"><div align="center">
<h2><a href="Toestelinfo.html">Toestel info</a></h2>
</div></td>
</tr>
</table></td>
</tr>
<tr>
<td height="495" colspan="4" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="832" height="495" align="center" valign="top" background="images/Company-Boxed_MainBox.jpg"><div align="center">
<p> </p>
<blockquote><br>
<h2>Kies hieronder aan welke eigenschappen het toestel moet voldoen.</h2>
<br>
<br>
<form method="post" action="result.php">
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
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
// connect script
$db_host = 'localhost';
$db_user = 'interfoon';
$db_pass = '';
$db_name = 'interfoon_nl_db';
mysql_connect ($db_host, $db_user, $db_pass);
@mysql_select_db ($db_name) or die ('Fout bij het selecteren van de database');
unset ($db_host, $db_user, $db_pass, $db_name);
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if ($_POST['merk'] != 'geen voorkeur') {
$voorwaarden = 1;
$and = false;
}
else {
$voorwaarden = "merk LIKE '".$_POST['merk']."'";
$and = true;
}
if (isset ($_POST['camera'])) {
if ($and) {
$voorwaarden = ' AND camera = 1';
}
else {
$voorwaarden = 'camera = 1';
$and = true;
}
}
if (isset ($_POST['bluetooth'])) {
if ($and) {
$voorwaarden = ' AND bluetooth = 1';
}
else {
$voorwaarden = 'bluetooth = 1';
$and = true;
}
}
if (isset ($_POST['umts'])) {
if ($and) {
$voorwaarden = ' AND umts = 1';
}
else {
$voorwaarden = 'umts = 1';
$and = true;
}
}
$sql = "
SELECT merk, model, kort, prijs, link
FROM products
//WHERE" . $voorwaarden;
// hierna je query uitvoeren
echo $sql;
}
?>
// connect script
$db_host = 'localhost';
$db_user = 'interfoon';
$db_pass = '';
$db_name = 'interfoon_nl_db';
mysql_connect ($db_host, $db_user, $db_pass);
@mysql_select_db ($db_name) or die ('Fout bij het selecteren van de database');
unset ($db_host, $db_user, $db_pass, $db_name);
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if ($_POST['merk'] != 'geen voorkeur') {
$voorwaarden = 1;
$and = false;
}
else {
$voorwaarden = "merk LIKE '".$_POST['merk']."'";
$and = true;
}
if (isset ($_POST['camera'])) {
if ($and) {
$voorwaarden = ' AND camera = 1';
}
else {
$voorwaarden = 'camera = 1';
$and = true;
}
}
if (isset ($_POST['bluetooth'])) {
if ($and) {
$voorwaarden = ' AND bluetooth = 1';
}
else {
$voorwaarden = 'bluetooth = 1';
$and = true;
}
}
if (isset ($_POST['umts'])) {
if ($and) {
$voorwaarden = ' AND umts = 1';
}
else {
$voorwaarden = 'umts = 1';
$and = true;
}
}
$sql = "
SELECT merk, model, kort, prijs, link
FROM products
//WHERE" . $voorwaarden;
// hierna je query uitvoeren
echo $sql;
}
?>
<table>
<tr>
<td><font face="arial" size=2>Welk merk toestel moet het zijn?</font><br>
<font size=1 face=arial>Kies uit een merk of geen aan "geen voorkeur".</font></td>
<td><select name="merk" style="background-color: #dcdcdc; border: 1px solid #000000;">
<option value="geen voorkeur">geen voorkeur</option>
<option value="Blackberry">Blackberry</option>
<option value="Imate">Imate</option>
<option value="LG">LG</option>
<option value="Motorola">Motorola</option>
<option value="Nokia">Nokia</option>
<option value="Samsung">Samsung</option>
<option value="Sharp">Sharp</option>
<option value="Siemens">Siemens</option>
<option value="Sony-Ericsson">Sony-Ericsson</option>
</select></td>
</tr>
<tr>
<td><font face="arial" size=2>Wilt u een camera op de telefoon?</font><br>
<font size=1 face=arial>Vink aan indien de klant een camera wenst.</font></td>
<td><input name="camera" type="checkbox" value="camera"></td>
</tr>
<tr>
<td><font face="arial" size=2>Wilt u bluetooth op uw toestel?</font><br>
<font size=1 face=arial>Vink aan indien de klant bluetooth wenst.</font> <br>
<font size=1 face=arial><A HREF="bluetooth.html" onClick="popup = window.open('bluetooth.html', 'PopupPage', 'height=450,width=500,scrollbars=yes,resizable=yes'); return false" target="_blank">Wat is bluetooth?</a> </font></td>
<td><input name="bluetooth" type="checkbox" value="bluetooth"></td>
</tr>
<tr>
<td><font face="arial" size=2>Wilt u een UMTS toestel?</font><br>
<font size=1 face=arial>Vink aan indien de klant een UMTS toestel wenst.</font><br>
<font size=1 face=arial> <A HREF="UMTS.html" onClick="popup = window.open('UMTS.html', 'PopupPage', 'height=450,width=500,scrollbars=yes,resizable=yes'); return false" target="_blank">Wat is UMTS?</a> </font></td>
<td><input name="umts" type="checkbox" value="umts"></td>
</tr>
<br>
<tr>
<td><input type="submit" Value="Nu zoeken" style="background-color: #dcdcdc; border: 1 solid #000000">
<input type="reset" Value="Ik doe iets fout" style="background-color: #dcdcdc; border: 1 solid #000000"></td>
</tr>
</table>
</form>
</blockquote>
</div></td>
</tr>
</table></td>
</tr>
<tr>
<td height="85" colspan="5" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="1024" height="85" align="center" valign="bottom" background="images/ja.jpg"><div align="center">
<h5>Copyright (c) 2006 <a href="mailto:[email protected]">Mike</a></h5>
</div></td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
dit is de hele pagina
maar hij maakt geen subselectie volgens mij en ik kom er zelf niet uit hoe.
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
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
<?php
// connect script
$db_host = 'localhost';
$db_user = 'interfoon';
$db_pass = '';
$db_name = 'interfoon_nl_db';
mysql_connect ($db_host, $db_user, $db_pass);
@mysql_select_db ($db_name) or die ('Fout bij het selecteren van de database');
unset ($db_host, $db_user, $db_pass, $db_name);
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if ($_POST['merk'] != 'geen voorkeur') {
$voorwaarden = 1;
$and = false;
}
else {
$voorwaarden = "merk LIKE '".$_POST['merk']."'";
$and = true;
}
if (isset ($_POST['camera'])) {
if ($and) {
$voorwaarden = ' AND camera = 1';
}
else {
$voorwaarden = 'camera = 1';
$and = true;
}
}
if (isset ($_POST['bluetooth'])) {
if ($and) {
$voorwaarden = ' AND bluetooth = 1';
}
else {
$voorwaarden = 'bluetooth = 1';
$and = true;
}
}
if (isset ($_POST['umts'])) {
if ($and) {
$voorwaarden = ' AND umts = 1';
}
else {
$voorwaarden = 'umts = 1';
$and = true;
}
}
$sql = "
SELECT merk, model, kort, prijs, link
FROM products
//WHERE" . $voorwaarden;
// hierna je query uitvoeren
echo $sql;
?>
// connect script
$db_host = 'localhost';
$db_user = 'interfoon';
$db_pass = '';
$db_name = 'interfoon_nl_db';
mysql_connect ($db_host, $db_user, $db_pass);
@mysql_select_db ($db_name) or die ('Fout bij het selecteren van de database');
unset ($db_host, $db_user, $db_pass, $db_name);
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if ($_POST['merk'] != 'geen voorkeur') {
$voorwaarden = 1;
$and = false;
}
else {
$voorwaarden = "merk LIKE '".$_POST['merk']."'";
$and = true;
}
if (isset ($_POST['camera'])) {
if ($and) {
$voorwaarden = ' AND camera = 1';
}
else {
$voorwaarden = 'camera = 1';
$and = true;
}
}
if (isset ($_POST['bluetooth'])) {
if ($and) {
$voorwaarden = ' AND bluetooth = 1';
}
else {
$voorwaarden = 'bluetooth = 1';
$and = true;
}
}
if (isset ($_POST['umts'])) {
if ($and) {
$voorwaarden = ' AND umts = 1';
}
else {
$voorwaarden = 'umts = 1';
$and = true;
}
}
$sql = "
SELECT merk, model, kort, prijs, link
FROM products
//WHERE" . $voorwaarden;
// hierna je query uitvoeren
echo $sql;
?>
Moet in result.php in plaats van de query die je daar nu hebt staan.
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Debitel Sales Tool - Hoofdpagina</title>
</head>
<body>
<body text="#668014">
<body link="#009ACD">
<body vlink="#556B2F">
<body alink="#009ACD">
<table width="1024" border="0" cellpadding="0" cellspacing="0">
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14
<?php
$db = mysql_connect("localhost", "root");
mysql_select_db("mydb",$db);
?>
$db = mysql_connect("localhost", "root");
mysql_select_db("mydb",$db);
?>
<!--DWLayoutTable-->
<tr>
<td height="81" colspan="5" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="1024" height="81" background="images/ja.jpg"><div align="center">
<h1>Debitel Sales Tool</h1>
</div></td>
</tr>
</table></td>
</tr>
<tr>
<td width="192" rowspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="325" height="602" valign="top" background="images/Company-Boxed_SideBox.jpg"><blockquote>
<p> </p>
<p align="center">Hier vind je de laatste info!<br />
"info"</p>
</blockquote>
</td>
</tr>
</table></td>
<td width="208" height="107" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="208" height="107" align="center" valign="middle" background="images/Company-Boxed_TobBox_01.jpg"><div align="center">
<h2><a href="index.html">Home</a></h2>
</div></td>
</tr>
</table></td>
<td width="208" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td color="#668014" width="208" height="107" align="center" valign="middle" background="images/Company-Boxed_TobBox_02.jpg"><div align="center">
<h2><a href="aanbiedingdoen.html">Aanbieding doen</a></h2>
</div></td>
</tr>
</table></td>
<td width="208" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="208" height="107" align="center" valign="middle" background="images/Company-Boxed_TobBox_03.jpg">
<H2 align="center"><a href="Argumentatie.html">Argumentatie</a></h2>
</td>
</tr>
</table></td>
<td width="208" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="208" height="107" align="center" valign="middle" background="images/Company-Boxed_TobBox_04.jpg"><div align="center">
<h2><a href="Toestelinfo.html">Toestel info</a></h2>
</div></td>
</tr>
</table></td>
</tr>
<tr>
<td height="495" colspan="4" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="832" height="495" align="center" valign="top" background="images/Company-Boxed_MainBox.jpg"><div align="center">
<p> </p>
<blockquote>
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
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
<?php
$result = mysql_query("SELECT * FROM products",$db);
echo "<table border=1>\n";
echo "<tr><td>merk</td><td>model</td><td>prijs in €</td><td>kort</td><td>leverbaar</td><td>link</td></tr>\n";
while ($myrow = mysql_fetch_row($result)) {
printf("<tr><td>%s</td> <td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>\n",
$myrow[1], $myrow[2], $myrow[4], $myrow[3], $myrow[8], $myrow[9]);
}
echo "</query>\n";
?>
$result = mysql_query("SELECT * FROM products",$db);
echo "<table border=1>\n";
echo "<tr><td>merk</td><td>model</td><td>prijs in €</td><td>kort</td><td>leverbaar</td><td>link</td></tr>\n";
while ($myrow = mysql_fetch_row($result)) {
printf("<tr><td>%s</td> <td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>\n",
$myrow[1], $myrow[2], $myrow[4], $myrow[3], $myrow[8], $myrow[9]);
}
echo "</query>\n";
?>
<p align="left"> </p>
<p align="left"><br />
</p>
<p align="left"></p>
<p align="left"> </p>
</blockquote>
</div></td>
</tr>
</table></td>
</tr>
<tr>
<td height="85" colspan="5" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="1024" height="85" align="center" valign="bottom" background="images/ja.jpg"><div align="center">
<h5>Copyright (c) 2006 <a href="mailto:[email protected]">Mike</a></h5>
</div></td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
mijn result ziet er nu dus zo uit.
dus wat moet ik precies vervangen en hoe komt mijn zoekpagina er dan uit te zien
??
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Debitel Sales Tool - Hoofdpagina</title>
</head>
<body>
<body text="#668014">
<body link="#009ACD">
<body vlink="#556B2F">
<body alink="#009ACD">
<table width="1024" border="0" cellpadding="0" cellspacing="0">
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14
<?php
$db = mysql_connect("localhost", "root");
mysql_select_db("mydb",$db);
?>
$db = mysql_connect("localhost", "root");
mysql_select_db("mydb",$db);
?>
<!--DWLayoutTable-->
<tr>
<td height="81" colspan="5" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="1024" height="81" background="images/ja.jpg"><div align="center">
<h1>Debitel Sales Tool</h1>
</div></td>
</tr>
</table></td>
</tr>
<tr>
<td width="192" rowspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="325" height="602" valign="top" background="images/Company-Boxed_SideBox.jpg"><blockquote>
<p> </p>
<p align="center">Hier vind je de laatste info!<br />
"info"</p>
</blockquote>
</td>
</tr>
</table></td>
<td width="208" height="107" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="208" height="107" align="center" valign="middle" background="images/Company-Boxed_TobBox_01.jpg"><div align="center">
<h2><a href="index.html">Home</a></h2>
</div></td>
</tr>
</table></td>
<td width="208" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td color="#668014" width="208" height="107" align="center" valign="middle" background="images/Company-Boxed_TobBox_02.jpg"><div align="center">
<h2><a href="aanbiedingdoen.html">Aanbieding doen</a></h2>
</div></td>
</tr>
</table></td>
<td width="208" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="208" height="107" align="center" valign="middle" background="images/Company-Boxed_TobBox_03.jpg">
<H2 align="center"><a href="Argumentatie.html">Argumentatie</a></h2>
</td>
</tr>
</table></td>
<td width="208" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="208" height="107" align="center" valign="middle" background="images/Company-Boxed_TobBox_04.jpg"><div align="center">
<h2><a href="Toestelinfo.html">Toestel info</a></h2>
</div></td>
</tr>
</table></td>
</tr>
<tr>
<td height="495" colspan="4" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="832" height="495" align="center" valign="top" background="images/Company-Boxed_MainBox.jpg"><div align="center">
<p> </p>
<blockquote>
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
76
77
78
79
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
76
77
78
79
<?php
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if ($_POST['merk'] != 'geen voorkeur') {
$voorwaarden = 1;
$and = false;
}
else {
$voorwaarden = "merk LIKE '".$_POST['merk']."'";
$and = true;
}
if (isset ($_POST['camera'])) {
if ($and) {
$voorwaarden = ' AND camera = 1';
}
else {
$voorwaarden = 'camera = 1';
$and = true;
}
}
if (isset ($_POST['bluetooth'])) {
if ($and) {
$voorwaarden = ' AND bluetooth = 1';
}
else {
$voorwaarden = 'bluetooth = 1';
$and = true;
}
}
if (isset ($_POST['umts'])) {
if ($and) {
$voorwaarden = ' AND umts = 1';
}
else {
$voorwaarden = 'umts = 1';
$and = true;
}
}
$sql = "
SELECT merk, model, kort, prijs, link
FROM products
//WHERE" . $voorwaarden;
// hierna je query uitvoeren
$result=mysql_query($sql);
echo "<table border=1>\n";
echo "<tr><td>merk</td><td>model</td><td>prijs in €</td><td>kort</td><td>leverbaar</td><td>link</td></tr>\n";
while ($myrow = mysql_fetch_row($result)) {
printf("<tr><td>%s</td> <td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>\n",
$myrow[1], $myrow[2], $myrow[4], $myrow[3], $myrow[8], $myrow[9]);
}
echo "</query>\n";
?>
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if ($_POST['merk'] != 'geen voorkeur') {
$voorwaarden = 1;
$and = false;
}
else {
$voorwaarden = "merk LIKE '".$_POST['merk']."'";
$and = true;
}
if (isset ($_POST['camera'])) {
if ($and) {
$voorwaarden = ' AND camera = 1';
}
else {
$voorwaarden = 'camera = 1';
$and = true;
}
}
if (isset ($_POST['bluetooth'])) {
if ($and) {
$voorwaarden = ' AND bluetooth = 1';
}
else {
$voorwaarden = 'bluetooth = 1';
$and = true;
}
}
if (isset ($_POST['umts'])) {
if ($and) {
$voorwaarden = ' AND umts = 1';
}
else {
$voorwaarden = 'umts = 1';
$and = true;
}
}
$sql = "
SELECT merk, model, kort, prijs, link
FROM products
//WHERE" . $voorwaarden;
// hierna je query uitvoeren
$result=mysql_query($sql);
echo "<table border=1>\n";
echo "<tr><td>merk</td><td>model</td><td>prijs in €</td><td>kort</td><td>leverbaar</td><td>link</td></tr>\n";
while ($myrow = mysql_fetch_row($result)) {
printf("<tr><td>%s</td> <td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>\n",
$myrow[1], $myrow[2], $myrow[4], $myrow[3], $myrow[8], $myrow[9]);
}
echo "</query>\n";
?>
<p align="left"> </p>
<p align="left"><br />
</p>
<p align="left"></p>
<p align="left"> </p>
</blockquote>
</div></td>
</tr>
</table></td>
</tr>
<tr>
<td height="85" colspan="5" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="1024" height="85" align="center" valign="bottom" background="images/ja.jpg"><div align="center">
<h5>Copyright (c) 2006 <a href="mailto:[email protected]">Mike</a></h5>
</div></td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>