PHP zoekfunctie in sql

Overzicht Reageren

Sponsored by: Vacatures door Monsterboard

Pagina: « vorige 1 2 3 4 5 volgende »

Michael

Michael

25/01/2006 12:25:00
Quote Anchor link
ok ff testen
 
PHP hulp

PHP hulp

16/01/2025 10:58:14
 
Michael

Michael

25/01/2006 12:30:00
Quote Anchor link
http://members.lycos.nl/interfoon/mettoestel.php

hij geeft een fout

Parse error: parse error in /data/members/free/tripod/nl/i/n/t/interfoon/htdocs/result.php on line 214
 
Robert Deiman

Robert Deiman

25/01/2006 12:36:00
Quote Anchor link
<!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)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?php







$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>&nbsp;</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>&nbsp;</p>
<blockquote>

Code (php)
PHP script in nieuw venster Selecteer het PHP script
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
<?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";






?>

<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>
 
Michael

Michael

25/01/2006 12:43:00
Quote Anchor link
ok hij doet het maar geeft geen resultaten vanuit de database nu.
eerst gaf ie alles weer , nu dus niets
 
Robert Deiman

Robert Deiman

25/01/2006 12:46:00
Quote Anchor link
Zo dan?
<!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)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
<?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);
?>


<!--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>&nbsp;</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>&nbsp;</p>
<blockquote>

Code (php)
PHP script in nieuw venster Selecteer het PHP script
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
<?php

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    if ($_POST['merk'] != 'geen voorkeur') {
      $voorwaarden = 1;
      $and = false;
    }

    else {
      $voorwaarden = "WHERE merk LIKE '".$_POST['merk']."'";
      $and = true;
    }

    if (isset ($_POST['camera'])) {
      if ($and) {
        $voorwaarden = ' AND camera = 1';
      }

      else {
        $voorwaarden = 'WHERE camera = 1';
        $and = true;
      }
    }

    if (isset ($_POST['bluetooth'])) {
      if ($and) {
        $voorwaarden = ' AND bluetooth = 1';
      }

      else {
        $voorwaarden = 'WHERE bluetooth = 1';
        $and = true;
      }
    }

    if (isset ($_POST['umts'])) {
      if ($and) {
        $voorwaarden = ' AND umts = 1';
      }

      else {
        $voorwaarden = 'WHERE umts = 1';
        $and = true;
      }
    }

    $sql = "
      SELECT merk, model, kort, prijs, link
      FROM products"
. $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>
Gewijzigd op 25/01/2006 12:53:00 door Robert Deiman
 
Michael

Michael

25/01/2006 12:51:00
Quote Anchor link
ff kijken maar maakt hij zo wel connectie met mij database?
 
Michael

Michael

25/01/2006 12:56:00
Quote Anchor link
zo geeft hij ook geen resultaten weer
 
Robert Deiman

Robert Deiman

25/01/2006 13:12:00
Quote Anchor link
Met de hierboven aangepaste code dan? Staat verbindingscode nu wel bij in.
 
Michael

Michael

25/01/2006 13:21:00
Quote Anchor link
<!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)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?php







$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>&nbsp;</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>&nbsp;</p>
<blockquote>

Code (php)
PHP script in nieuw venster Selecteer het PHP script
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
80
81
82
83
84
85
86
87
88
89
90
91
<?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 = "WHERE merk LIKE '".$_POST['merk']."'";
      $and = true;
    }

    if (isset ($_POST['camera'])) {
      if ($and) {
        $voorwaarden = ' AND camera = 1';
      }

      else {
        $voorwaarden = 'WHERE camera = 1';
        $and = true;
      }
    }

    if (isset ($_POST['bluetooth'])) {
      if ($and) {
        $voorwaarden = ' AND bluetooth = 1';
      }

      else {
        $voorwaarden = 'WHERE bluetooth = 1';
        $and = true;
      }
    }

    if (isset ($_POST['umts'])) {
      if ($and) {
        $voorwaarden = ' AND umts = 1';
      }

      else {
        $voorwaarden = 'WHERE umts = 1';
        $and = true;
      }
    }

    $sql = "
      SELECT merk, model, kort, prijs, link
      FROM products"
. $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>

zo staat hij er nu in
 
Robert Deiman

Robert Deiman

25/01/2006 14:05:00
Quote Anchor link
Kan iemand ff helpen, ik zie de fout niet :S
 
Michael

Michael

25/01/2006 14:29:00
Quote Anchor link
en ik zie em al helemaal niet :S
 
Robert Deiman

Robert Deiman

25/01/2006 14:43:00
Quote Anchor link
zet eens een echo van je query direct na dit stukje:

$sql = "
SELECT merk, model, kort, prijs, link
FROM products" . $voorwaarden;
// hierna je query uitvoeren

en kijk of wel klopt wat hier staat.
 
Michael

Michael

25/01/2006 14:47:00
Quote Anchor link
$sql = "
SELECT merk, model, kort, prijs, link
FROM products" . $voorwaarden;
// hierna je query uitvoeren

echo "</query>\n";

zo bedoel je?
 
Robert Deiman

Robert Deiman

25/01/2006 14:57:00
Quote Anchor link
echo $sql; bedoel ik ;)
 
Michael

Michael

25/01/2006 15:16:00
Quote Anchor link
ok ff doen
 
Michael

Michael

25/01/2006 15:20:00
Quote Anchor link
SELECT merk, model, kort, prijs, link FROM productsWHERE merk LIKE 'geen voorkeur'merk






dit komt er nu bij te staan
 
Michael

Michael

25/01/2006 15:28:00
 
Robert Deiman

Robert Deiman

25/01/2006 16:43:00
Quote Anchor link
Zo dan, moet nu goed zijn geloof ik..

<!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">

<!--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>&nbsp;</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>&nbsp;</p>
<blockquote>

Code (php)
PHP script in nieuw venster Selecteer het PHP script
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
80
81
82
83
84
85
86
87
88
89
90
91
<?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 = "";
      $and = false;
    }

    else {
      $voorwaarden = " WHERE merk LIKE '".$_POST['merk']."'";
      $and = true;
    }

    if (isset ($_POST['camera'])) {
      if ($and) {
        $voorwaarden = ' AND camera = 1';
      }

      else {
        $voorwaarden = ' WHERE camera = 1';
        $and = true;
      }
    }

    if (isset ($_POST['bluetooth'])) {
      if ($and) {
        $voorwaarden = ' AND bluetooth = 1';
      }

      else {
        $voorwaarden = ' WHERE bluetooth = 1';
        $and = true;
      }
    }

    if (isset ($_POST['umts'])) {
      if ($and) {
        $voorwaarden = ' AND umts = 1';
      }

      else {
        $voorwaarden = ' WHERE umts = 1';
        $and = true;
      }
    }

    $sql = "
      SELECT merk, model, kort, prijs, link
      FROM products"
. $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>
 
Michael

Michael

26/01/2006 13:03:00
Quote Anchor link
ik ga em even testen
 
Michael

Michael

26/01/2006 13:08:00
Quote Anchor link
hij lijkt te werken
alleen de kolommen staan niet helemaal goed
 

Pagina: « vorige 1 2 3 4 5 volgende »



Overzicht Reageren

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.