Jump to content

[SOLVED] Undefined index


mkr365

Recommended Posts

Hello,

 

Well i have several errors:

 

Undefined index:  bedrijfsnaam in C:\\webroot\\Nieuw Bouwref\\headerarchitect.php on line 232

Undefined index:  categorien in C:\\webroot\\Nieuw Bouwref\\headerarchitect.php on line 241

 

line 232 : <tr><td>Bedrijfsnaam:</td><td><input type="text" name="bedrijfsnaam" value="'.$_GET['bedrijfsnaam'].'"input SIZE="30"></td></tr>

 

line 241: if ($_GET['categorien'] == $query['RubriekID'])

 

Seems like "bedrijfsnaam" and "categorien" are unknown but how do i make this variable known?

 

Thanks in advance

Link to comment
Share on other sites

They will only be known if the URL has ?bedrijfsnaam=someValue&categorien=otherValue

 

You can't force the URL to have either of those values so the best you can do is check for them and use defaults if they're not found.

 

<?php
// Top of your script
$Defaults = array();
$vars = array( 'bedrijfsnaam', 'categorien' );
foreach($vars as $var){
  $Defaults[$var] = isset($_GET[$var]) ? $_GET[$var] : '';
}

// Later when you need to use them, instead of $_GET use $Defaults...
echo $Defaults['bedrijfsnaam'];
?>

Link to comment
Share on other sites

those variables would have to be set by clicking some link that you have created. example

 

http://mypage.php?bedrijfsneem=hello&categorien=goodbye

 

If you are running a script on one page you can test for the values first

 

$bedrijfsnaam = isset($_GET['bedrijfsnaam']) ? $_GET['bedrijfsnaam'] : "default value";
$categorien = isset($_GET['categorien']) ? $_GET['categorien'] : "default value";

 

Now it will check to see if they are set. Also now you would use the variables $bedrijfsnaam and $categorien instead of The $_GET values

 

<tr><td>Bedrijfsnaam:</td><td><input type="text" name="bedrijfsnaam" value="'.$'bedrijfsnaam.'"input SIZE="30"></td></tr>

 

Ray

 

Link to comment
Share on other sites

Well i lost all the errors, thats good news off course. But i receive the next error:

 

Unknown column 'Array' in 'where clause'

 

<tr><td>Rubriek:</td><td>'; 
$sql = "SELECT * FROM rubrieken INNER JOIN groepen ON rubrieken.GroepID = groepen.GroepID WHERE Groepnaam = 'Architect' ORDER BY Rubrieknaam "; 
    $result = mysql_query($sql) or die(mysql_error()); 
    while($query = mysql_fetch_array($result)) 
    { 
        if ($categorien == $query['RubriekID']) 
              echo '<input type="checkbox" name="categorien[]" value="'.$query['RubriekID'].'" checked>'.$query['Rubrieknaam'].''; 
        else 
            echo '<input type="checkbox" name="categorien[]" value="'.$query['RubriekID'].'">'.$query['Rubrieknaam'].''; 
    } 
echo '</select></td></tr> 
<tr><td colspan="2"><input type="submit" value="zoeken"><input type="hidden" name="zoek" value="true"></td></tr> 

 

Another strange thing is that if i change :

 echo '<input type="checkbox" name="categorien[]" to 
echo '<input type="checkbox" name="categorien"

 

I can use my checkbox again but only a single one, if i select more than 1 checkbox than the results are only from 1 checkbox.

 

 

Link to comment
Share on other sites

Well i have another .php file wich is being called by this one. (I have to tell you that im not the one who is the author of this code, im trying to sort it out and change it to my wishes. But d..mn its pretty difficult).

 

I will post both, i understand if its to much code to sort out.

 

<?php

include("database.php");


trigger_error("Dit is een test");


// Clear cache
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i ") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");

//declareren variabelen
$default = 'logos/nopic.jpg'; //standaard plaatje als er geen plaatje is geupload
$server = 'http://www.bouwreferentie.nl/';
$numresults = 15;

$bedrijfsnaam = isset($_GET['bedrijfsnaam']) ? $_GET['bedrijfsnaam'] : "default value";
$categorien = isset($_GET['categorien']) ? $_GET['categorien'] : "default value";
$provincie = isset($_GET['provincie']) ? $_GET['provincie'] : "default value";


function url_exists($url) 
{

   
  $a_url = parse_url($url);
  if (!isset($a_url['port'])) $a_url['port'] = 80;
  $errno = 0;
  $errstr = '';
  $timeout = 30;
  if(isset($a_url['host']) && $a_url['host']!=gethostbyname($a_url['host'])){
     $fid = fsockopen($a_url['host'], $a_url['port'], $errno, $errstr, $timeout);
     if (!$fid) return false;
     $page = isset($a_url['path'])  ?$a_url['path']:'';
     $page .= isset($a_url['query'])?'?'.$a_url['query']:'';
     fputs($fid, 'HEAD '.$page.' HTTP/1.0'."\r\n".'Host: '.$a_url['host']."\r\n\r\n");
     $head = fread($fid, 4096);
     fclose($fid);
     return preg_match('#^HTTP/.*\s+[200|302]+\s#i', $head);
   } else {
     return false;
   }
}

echo '

<style type="text/css">

.border1 {
border: 1px solid #000000;
border-color: #71c0ea;
border-collapse: separate;
border-spacing: 1px;

}


<!--';

//#a9fe14
echo 'a:link      {color: #000000; text-decoration: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px}
a:visited   {color: #000000; text-decoration: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px}
a:hover     {color: #000000; text-decoration: underline; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px}
a:active    {color: #000000; text-decoration: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 11px }

font {font-family: Verdana, Helvetica, sans-serif; font-size: 11px}
table {font-family: Verdana, Helvetica, sans-serif; font-size: 11px}


-->
</style>

<html>
<head>
<head>
   <title>Bouwreferentie</title>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
    <meta http-equiv="Content-Language" content="nl" />
<meta name="keywords" content="bouwreferentie,bouw referentie,architecten,aannemers,portfolio,breferentie, b referentie" />
<meta name="description" content="Platform voor architecten, projectontwikkelaars/aannemers en toeleveranciers/producten.">
    <meta name="Robots" content="nofollow" />
    <style type="text/css">
    <!--
    body {
background: #ffffff;
font-family: Verdana, Arial, Helvetica, Sans-Serif;
font-size: 11px;
height: 0px;
margin-top: 70px;
margin-right: 0;
margin-bottom: 0;
margin-left: 0;
      }
    a {
      color: #000000;
      text-decoration: none;
      }
    a:hover {
      text-decoration: underline;
      }
    img {
      border: none;
      }
    .clear {
      clear: both;
      }
  
    #container {
      margin:10 auto;
      width: 780px;
      }
  
#adsense {
      background: #ffffff;
      float: right;
      height: 600px;
      width: 120px;
      position: absolute;
      top: 385px;
  margin-left: 800px;
      }    
  
 #adsense1 {
      background: #ffffff;
      float: right;
      height: 600px;
      width: 120px;
      position: absolute;
      top: 1023px;
  margin-left: 800px;
      }   
    
     #header {
      }
  
     #zoeken {
      background: #ffffff url(../public_html/images/zoek.gif) no-repeat;
      float: left;
      height: 198px;
      width: 341px;
  padding: 20px 0 0 0;
      }
  
 #menu {
      padding: 20px 0 0 0;
  }
    
 #architecten {
      padding: 20px 0 0 0;
  }
  
 #content {
 margin:0 auto;
 width: 648px;
 margin-top: -3px;
 padding-top: 65px;
 padding-right: 65px;
 padding-bottom: 0px;
 padding-left: 65px;
 background-color: #ffffff;
 background-repeat: repeat;
 border: 1px solid #13536e;
  }

    -->
    </style>

    <!--[if IE]>
      <style type="text/css">
      body {
        text-align: center;
        }
      #container {
        text-align: left;
	margin:10 auto;
	}		
  #content {	
	width: 780px;
        }
  #adsense {
  	margin-left: 20px;
	top: 368px;
	}		
  #adsense1 {
  	margin-left: 20px;
	top: 1006px;
	}			
      </style>
    <![endif]-->
</head>

  <body>
    <div id="container">
      	<div id="adsense"><script type="text/javascript"><!--
google_ad_client = "pub-1275974420039929";
google_ad_width = 120;
google_ad_height = 600;
google_ad_format = "120x600_as";
google_ad_type = "text_image";
google_ad_channel = "";
google_color_border = "5095bc";
google_color_bg = "FFFFFF";
google_color_link = "0000FF";
google_color_text = "000000";
google_color_url = "008000";
google_ui_features = "rc:6";
//-->
</script>
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>
      <div id="adsense1"><script type="text/javascript"><!--
google_ad_client = "pub-1275974420039929";
google_ad_width = 120;
google_ad_height = 600;
google_ad_format = "120x600_as";
google_ad_type = "text_image";
google_ad_channel = "";
google_color_border = "5095bc";
google_color_bg = "FFFFFF";
google_color_link = "0000FF";
google_color_text = "000000";
google_color_url = "008000";
google_ui_features = "rc:6";
//-->
</script>
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>
      <div id="menu"><img src="../../Nieuw Bouwref/images/menubalktest.gif" alt="" width="780" height="30" /></div>
      <div id="architecten"><img src="../../Nieuw Bouwref/images/Architectenbar.gif" alt="" width="780" height="22" /></div>
      <div id="zoeken">	

		<br><form action=""method="GET"><table align="center">
<tr><td>Bedrijfsnaam:</td><td><input type="text" name="bedrijfsnaam" value="'.$bedrijfsnaam.'"input SIZE="30"></td></tr>
<tr><td>Provincie:</td><td><select name="provincie"><option value="">Selecteer...</option> <OPTION VALUE="Groningen">Groningen</OPTION> <OPTION VALUE="Friesland">Friesland</OPTION> <OPTION VALUE="Drenthe">Drenthe</OPTION> <OPTION VALUE="Overijssel">Overijssel</OPTION> <OPTION VALUE="Gelderland">Gelderland</OPTION> <OPTION VALUE="Utrecht">Utrecht</OPTION> <OPTION VALUE="Flevoland">Flevoland</OPTION> <OPTION VALUE="Noord-Holland">Noord-Holland</OPTION> <OPTION VALUE="Zuid-Holland">Zuid-Holland</OPTION> <OPTION VALUE="Noord-Brabant">Noord-Brabant</OPTION> <OPTION VALUE="Limburg">Limburg</OPTION> <OPTION VALUE="Zeeland">Zeeland</OPTION> </td></tr>


<tr><td>Rubriek:</td><td>'; 
$sql = "SELECT * FROM rubrieken INNER JOIN groepen ON rubrieken.GroepID = groepen.GroepID WHERE Groepnaam = 'Architect' ORDER BY Rubrieknaam "; 
    $result = mysql_query($sql) or die(mysql_error()); 
    while($query = mysql_fetch_array($result)) 
    { 
        if ($categorien == $query['RubriekID']) 
              echo '<input type="checkbox" name="categorien[]" value="'.$query['RubriekID'].'" checked>'.$query['Rubrieknaam'].''; 
        else 
            echo '<input type="checkbox" name="categorien[]" value="'.$query['RubriekID'].'">'.$query['Rubrieknaam'].''; 
    } 
echo '</select></td></tr> 
<tr><td colspan="2"><input type="submit" value="zoeken"><input type="hidden" name="zoek" value="true"></td></tr> 

</table>
</form>

<br>
<center>
<a href="architecten.php?zoekletter=A">A</a> 
<a href="architecten.php?zoekletter=B">B</a> 
<a href="architecten.php?zoekletter=C">C</a> 
<a href="architecten.php?zoekletter=D">D</a> 
<a href="architecten.php?zoekletter=E">E</a> 
<a href="architecten.php?zoekletter=F">F</a> 
<a href="architecten.php?zoekletter=G">G</a> 
<a href="architecten.php?zoekletter=H">H</a> 
<a href="architecten.php?zoekletter=I">I</a> 
<a href="architecten.php?zoekletter=J">J</a> 
<a href="architecten.php?zoekletter=K">K</a> 
<a href="architecten.php?zoekletter=L">L</a> 
<a href="architecten.php?zoekletter=M">M</a> 
<a href="architecten.php?zoekletter=N">N</a> 
<a href="architecten.php?zoekletter=O">O</a> 
<a href="architecten.php?zoekletter=P">P</a> 
<a href="architecten.php?zoekletter=Q">Q</a> 
<a href="architecten.php?zoekletter=R">R</a> 
<a href="architecten.php?zoekletter=S">S</a> 
<a href="architecten.php?zoekletter=T">T</a> 
<a href="architecten.php?zoekletter=U">U</a> 
<a href="architecten.php?zoekletter=V">V</a> 
<a href="architecten.php?zoekletter=W">W</a> 
<a href="architecten.php?zoekletter=X">X</a> 
<a href="architecten.php?zoekletter=Y">Y</a> 
<a href="architecten.php?zoekletter=Z">Z</a><br><br>
</center>		





	</div>
        <div id="header">
        <div class="clear"></div>
      </div>
      <!-- header -->
      <!-- nav -->
      <!-- content -->


    </div> <!-- container -->

'
?> 

 

<?php
include("headerarchitect.php");



echo '<div id="content">';


if (isset($_GET['zoekletter']) || isset($_GET['zoek']))
{
if (isset($_GET['zoekletter']))
{
	echo 'gezocht op letter '.$_GET['zoekletter'].'<br><br>';

	$sql = "SELECT * FROM klantgegevens INNER JOIN rubrieken ON klantgegevens.Rubriek = rubrieken.RubriekID INNER JOIN groepen on rubrieken.GroepID = groepen.GroepID WHERE Bedrijfsnaam LIKE '".$_GET['zoekletter']."%' AND groepen.Groepnaam = 'Architect' ORDER BY Bedrijfsnaam ";
	$result = mysql_query($sql) or die(mysql_error()); 
	$query = mysql_num_rows($result);

	if ($query > 0)
	{
		if ($query < 15)
		{
			while($query = mysql_fetch_array($result))
			{
				$check = url_exists($server.'logos/'.$query['Portfolio'].'.jpg');
				if ($check == true)
					$imageurl = 'logos/'.$query['Portfolio'].'.jpg';
				else
					$imageurl = $default;



				echo '<table bgcolor="#ffffff" class="border1" onclick=window.open("http://www.bouwreferentie.nl/'.$query['Portfolio'].'")  style="cursor:pointer" onmouseover=style.borderColor="#13536e" onmouseout=style.borderColor="#5095bc" width="100%"><tr><td width="35%" rowspan="6" ><img src="'.$imageurl.'"></td><td width="15%">Bedrijfsnaam:</td><td width="50%">'.$query['Bedrijfsnaam'].'</td></tr>
				<tr><td width="15%">Adres:</td><td width="50%">'.$query['Straat'].' '.$query['Huisnummer'].' '.$query['Toevoeging'].'</td></tr>
				<tr><td width="15%">Postcode:</td><td width="50%">'.$query['Postcode'].'</td></tr>
				<tr><td width="15%">Provincie:</td><td width="50%">'.$query['Provincie'].'</td></tr>
				<tr><td width="15%">Rubriek:</td><td width="50%">'.$query['Rubrieknaam'].'</td></tr>
				<tr><td width="15%">Portfolio:</td><td width="50%"><a href="http://www.bouwreferentie.nl/'.$query['Portfolio'].'" target="_blanc">www.bouwreferentie.nl/'.$query['Portfolio'].'</a></td></tr>
				</table><br><br>';
			}
		}
		else
		{

			$numpages = ceil($count/$numresults); 	

			if (isset($_GET['page']))
				$page = $_GET['page'];
			else
				$page = 0;

			for ($i = 0; $i<$numpages; $i++)
			{
				echo '<a href="architecten.php?zoekletter='.$_GET['zoekletter'].'page='.$i.'">pag '.($i+1).'</a> || ';
			}
			echo '<br><br>';

			$sql = "SELECT * FROM klantgegevens INNER JOIN rubrieken ON klantgegevens.Rubriek = rubrieken.RubriekID INNER JOIN groepen on rubrieken.GroepID = groepen.GroepID WHERE Bedrijfsnaam LIKE '".$_GET['zoekletter']."%' AND groepen.Groepnaam = 'Architect' ORDER BY Bedrijfsnaam LIMIT ".($page*$numresults).", ".$numresults." ";
			$result = mysql_query($sql) or die(mysql_error()); 
			while($query = mysql_fetch_array($result))
			{
				$check = url_exists($server.'logos/'.$query['Portfolio'].'.jpg');
				if ($check == true)
					$imageurl = 'logos/'.$query['Portfolio'].'.jpg';
				else
					$imageurl = $default;

				echo '<table bgcolor="#ffffff" class="border1" onclick=window.open("http://www.bouwreferentie.nl/'.$query['Portfolio'].'")  style="cursor:pointer" onmouseover=style.borderColor="#13536e" onmouseout=style.borderColor="#5095bc" width="100%"><tr><td width="35%" rowspan="6" ><img src="'.$imageurl.'"></td><td width="15%">Bedrijfsnaam:</td><td width="50%">'.$query['Bedrijfsnaam'].'</td></tr>
				<tr><td width="15%">Adres:</td><td width="50%">'.$query['Straat'].' '.$query['Huisnummer'].' '.$query['Toevoeging'].'</td></tr>
				<tr><td width="15%">Postcode:</td><td width="50%">'.$query['Postcode'].'</td></tr>
				<tr><td width="15%">Provincie:</td><td width="50%">'.$query['Provincie'].'</td></tr>
				<tr><td width="15%">Rubriek:</td><td width="50%">'.$query['Rubrieknaam'].'</td></tr>
				<tr><td width="15%">Portfolio:</td><td width="50%"><a href="http://www.bouwreferentie.nl/'.$query['Portfolio'].'" target="_blanc">www.bouwreferentie.nl/'.$query['Portfolio'].'</a></td></tr>
				</table><br><br>';
			}
			echo '|| ';
			for ($i = 0; $i<$numpages; $i++)
			{
				echo '<a href="architecten.php?zoekletter='.$_GET['zoekletter'].'page='.$i.'">pag '.($i+1).'</a> || ';
			}

		}
	}
	else
	{
		echo 'Helaas geen bedrijven gevonden.';		
	}
}

if (isset($_GET['zoek']))
{
	//echo 'gezocht op woord '.$_GET['zoek'].'<br><br>';
	$first = true;

	if ($bedrijfsnaam != NULL)
	{
		$bedrijfsnaam = 'Bedrijfsnaam LIKE "%'.$bedrijfsnaam.'%" ';
		$first = false;
	}
	else
		$bedrijfsnaam = "";	

	if ($provincie != NULL)
	{	
		if ($first == false)
		{
			$provincie = 'AND Provincie LIKE "%'.$provincie.'%" ';	
		}
		else
			$provincie = 'Provincie LIKE "%'.$provincie.'%" ';		
		$first = false;
	}
	if (($categorien != "") && ($bedrijfsnaam == NULL) && ($provincie == NULL))
	{
		$categorie = true;
	}

	if (($first == false) || ($categorie == true))
	{
		if($categorien != "")
			$sql = "SELECT * FROM klantgegevens INNER JOIN rubrieken ON klantgegevens.Rubriek = rubrieken.RubriekID INNER JOIN groepen on rubrieken.GroepID = groepen.GroepID WHERE ".$bedrijfsnaam." ".$provincie." AND Rubriek = ".$categorien." AND groepen.Groepnaam = 'Architect' ORDER BY Bedrijfsnaam  ";
		else
			$sql = "SELECT * FROM klantgegevens INNER JOIN rubrieken ON klantgegevens.Rubriek = rubrieken.RubriekID INNER JOIN groepen on rubrieken.GroepID = groepen.GroepID WHERE ".$bedrijfsnaam." ".$provincie." AND groepen.Groepnaam = 'Architect' ORDER BY Bedrijfsnaam ";
		if ($categorie == true)
			$sql = "SELECT * FROM klantgegevens INNER JOIN rubrieken ON klantgegevens.Rubriek = rubrieken.RubriekID INNER JOIN groepen on rubrieken.GroepID = groepen.GroepID WHERE Rubriek = ".$categorien." AND groepen.Groepnaam = 'Architect' ORDER BY Bedrijfsnaam  ";

		$result = mysql_query($sql) or die(mysql_error()); 
		$query = mysql_num_rows($result);
		if ($query > 0)
		{
			if ($query < 15)
			{
				while($query = mysql_fetch_array($result))
				{
					$check = url_exists($server.'logos/'.$query['Portfolio'].'.jpg');
					if ($check == true)
						$imageurl = 'logos/'.$query['Portfolio'].'.jpg';
					else
						$imageurl = $default;

					echo '<table bgcolor="#ffffff" class="border1" onclick=window.open("http://www.bouwreferentie.nl/'.$query['Portfolio'].'")  style="cursor:pointer" onmouseover=style.borderColor="#13536e" onmouseout=style.borderColor="#5095bc" width="100%"><tr><td width="35%" rowspan="6" ><img src="'.$imageurl.'"></td><td width="15%">Bedrijfsnaam:</td><td width="50%">'.$query['Bedrijfsnaam'].'</td></tr>
				<tr><td width="15%">Adres:</td><td width="50%">'.$query['Straat'].' '.$query['Huisnummer'].' '.$query['Toevoeging'].'</td></tr>
				<tr><td width="15%">Postcode:</td><td width="50%">'.$query['Postcode'].'</td></tr>
				<tr><td width="15%">Provincie:</td><td width="50%">'.$query['Provincie'].'</td></tr>
				<tr><td width="15%">Rubriek:</td><td width="50%">'.$query['Rubrieknaam'].'</td></tr>
				<tr><td width="15%">Portfolio:</td><td width="50%"><a href="http://www.bouwreferentie.nl/'.$query['Portfolio'].'" target="_blanc">www.bouwreferentie.nl/'.$query['Portfolio'].'</a></td></tr>
				</table><br><br>';
				}
			}
			else
			{

				$numpages = ceil($query/$numresults);
				//echo 'num pages = '.$numpages; 	

				if (isset($_GET['page']))
					$page = $_GET['page'];
				else
					$page = 0;

				for ($i = 0; $i<$numpages; $i++)
				{
					echo '<a href="architecten.php?bedrijfsnaam='.$bedrijfsnaam.'&provincie='.$provincie.'&categorien='.$categorien.'&zoek=true&page='.$i.'">pag '.($i+1).'</a> || ';
				}
				echo '<br><br>';

				if($categorien != "")
			$sql = "SELECT * FROM klantgegevens INNER JOIN rubrieken ON klantgegevens.Rubriek = rubrieken.RubriekID INNER JOIN groepen on rubrieken.GroepID = groepen.GroepID WHERE ".$bedrijfsnaam." ".$provincie." AND Rubriek = ".$categorien." AND groepen.Groepnaam = 'Architect' ORDER BY Bedrijfsnaam LIMIT ".($page*$numresults).", ".$numresults."  ";
		else
			$sql = "SELECT * FROM klantgegevens INNER JOIN rubrieken ON klantgegevens.Rubriek = rubrieken.RubriekID INNER JOIN groepen on rubrieken.GroepID = groepen.GroepID WHERE ".$bedrijfsnaam." ".$provincie." AND groepen.Groepnaam = 'Architect' ORDER BY Bedrijfsnaam LIMIT ".($page*$numresults).", ".$numresults." ";
		if ($categorie == true)
			$sql = "SELECT * FROM klantgegevens INNER JOIN rubrieken ON klantgegevens.Rubriek = rubrieken.RubriekID INNER JOIN groepen on rubrieken.GroepID = groepen.GroepID WHERE Rubriek = ".$categorien." AND groepen.Groepnaam = 'Architect' ORDER BY Bedrijfsnaam LIMIT ".($page*$numresults).", ".$numresults."  ";

				$result = mysql_query($sql) or die(mysql_error()); 
				while($query = mysql_fetch_array($result))
				{
					$check = url_exists($server.'logos/'.$query['Portfolio'].'.jpg');
					if ($check == true)
						$imageurl = 'logos/'.$query['Portfolio'].'.jpg';
					else
						$imageurl = $default;

					echo '<table bgcolor="#ffffff" class="border1" onclick=window.open("http://www.bouwreferentie.nl/'.$query['Portfolio'].'")  style="cursor:pointer" onmouseover=style.borderColor="#13536e" onmouseout=style.borderColor="#5095bc" width="100%"><tr><td width="35%" rowspan="6" ><img src="'.$imageurl.'"></td><td width="15%">Bedrijfsnaam:</td><td width="50%">'.$query['Bedrijfsnaam'].'</td></tr>
				<tr><td width="15%">Adres:</td><td width="50%">'.$query['Straat'].' '.$query['Huisnummer'].' '.$query['Toevoeging'].'</td></tr>
				<tr><td width="15%">Postcode:</td><td width="50%">'.$query['Postcode'].'</td></tr>
				<tr><td width="15%">Provincie:</td><td width="50%">'.$query['Provincie'].'</td></tr>
				<tr><td width="15%">Rubriek:</td><td width="50%">'.$query['Rubrieknaam'].'</td></tr>
				<tr><td width="15%">Portfolio:</td><td width="50%"><a href="http://www.bouwreferentie.nl/'.$query['Portfolio'].'" target="_blanc">www.bouwreferentie.nl/'.$query['Portfolio'].'</a></td></tr>
				</table><br><br>';
				}
				echo '|| ';
				for ($i = 0; $i<$numpages; $i++)
				{
					echo '<a href="architecten.php?bedrijfsnaam='.$bedrijfsnaam.'&provincie='.$provincie.'&categorien='.$categorien.'&zoek=true&page='.$i.'">pag '.($i+1).'</a> || ';
				}

			}
		}
		else
		{
			echo 'Helaas geen bedrijven gevonden.';		
		}
	}
}
}
else
{
$sql = "SELECT * FROM klantgegevens INNER JOIN rubrieken ON klantgegevens.Rubriek = rubrieken.RubriekID INNER JOIN groepen on rubrieken.GroepID = groepen.GroepID WHERE groepen.Groepnaam = 'Architect' ORDER BY Bedrijfsnaam ";
$result = mysql_query($sql) or die(mysql_error()); 
$count = mysql_num_rows($result);
if ($count < 15)
{
	while($query = mysql_fetch_array($result))
	{
		$check = url_exists($server.'logos/'.$query['Portfolio'].'.jpg');
		if ($check == true)
			$imageurl = 'logos/'.$query['Portfolio'].'.jpg';
		else
			$imageurl = $default;

		echo '<table bgcolor="#ffffff" class="border1" onclick=window.open("http://www.bouwreferentie.nl/'.$query['Portfolio'].'")  style="cursor:pointer" onmouseover=style.borderColor="#13536e" onmouseout=style.borderColor="#5095bc" width="100%"><tr><td width="35%" rowspan="6" ><img src="'.$imageurl.'"></td><td width="15%">Bedrijfsnaam:</td><td width="50%">'.$query['Bedrijfsnaam'].'</td></tr>
				<tr><td width="15%">Adres:</td><td width="50%">'.$query['Straat'].' '.$query['Huisnummer'].' '.$query['Toevoeging'].'</td></tr>
				<tr><td width="15%">Postcode:</td><td width="50%">'.$query['Postcode'].'</td></tr>
				<tr><td width="15%">Provincie:</td><td width="50%">'.$query['Provincie'].'</td></tr>
				<tr><td width="15%">Rubriek:</td><td width="50%">'.$query['Rubrieknaam'].'</td></tr>
				<tr><td width="15%">Portfolio:</td><td width="50%"><a href="http://www.bouwreferentie.nl/'.$query['Portfolio'].'" target="_blanc">www.bouwreferentie.nl/'.$query['Portfolio'].'</a></td></tr>
				</table><br><br>';
	}
}
else
{

	$numpages = ceil($count/$numresults);
	//echo 'num pages = '.$numpages; 	

	if (isset($_GET['page']))
		$page = $_GET['page'];
	else
		$page = 0;

	for ($i = 0; $i<$numpages; $i++)
	{
		echo '<a href="architecten.php?page='.$i.'">pag '.($i+1).'</a> || ';
	}
	echo '<br><br>';

	$sql = "SELECT * FROM klantgegevens INNER JOIN rubrieken ON klantgegevens.Rubriek = rubrieken.RubriekID INNER JOIN groepen on rubrieken.GroepID = groepen.GroepID WHERE groepen.Groepnaam = 'Architect' ORDER BY Bedrijfsnaam LIMIT ".($page*$numresults).", ".$numresults." ";
	$result = mysql_query($sql) or die(mysql_error()); 
	while($query = mysql_fetch_array($result))
	{
		$check = url_exists($server.'logos/'.$query['Portfolio'].'.jpg');
		if ($check == true)
			$imageurl = 'logos/'.$query['Portfolio'].'.jpg';
		else
			$imageurl = $default;

		echo '<table bgcolor="#ffffff" class="border1" onclick=window.open("http://www.bouwreferentie.nl/'.$query['Portfolio'].'")  style="cursor:pointer" onmouseover=style.borderColor="#13536e" onmouseout=style.borderColor="#5095bc" width="100%"><tr><td width="35%" rowspan="6" ><img src="'.$imageurl.'"></td><td width="15%">Bedrijfsnaam:</td><td width="50%">'.$query['Bedrijfsnaam'].'</td></tr>
				<tr><td width="15%">Adres:</td><td width="50%">'.$query['Straat'].' '.$query['Huisnummer'].' '.$query['Toevoeging'].'</td></tr>
				<tr><td width="15%">Postcode:</td><td width="50%">'.$query['Postcode'].'</td></tr>
				<tr><td width="15%">Provincie:</td><td width="50%">'.$query['Provincie'].'</td></tr>
				<tr><td width="15%">Rubriek:</td><td width="50%">'.$query['Rubrieknaam'].'</td></tr>
				<tr><td width="15%">Portfolio:</td><td width="50%"><a href="http://www.bouwreferentie.nl/'.$query['Portfolio'].'" target="_blanc">www.bouwreferentie.nl/'.$query['Portfolio'].'</a></td></tr>
				</table><br><br>';
	}
	echo '|| ';
	for ($i = 0; $i<$numpages; $i++)
	{
		echo '<a href="architecten.php?page='.$i.'">pag '.($i+1).'</a> || ';
	}

}
}

include("footer.php");

?>

 

 

Link to comment
Share on other sites

If you want to try and figure this out do a search and replace in your script so we can trouble shoot.

 

search for

or die(mysql_error());

and replace it with

or die("MySQL Error<br>SQL statement: $sql<br>Error: ".mysql_error());

 

Once you run the script now you will get the error and the statement you are trying to pass to mysql. Now we can troubleshoot.

 

Ray

Link to comment
Share on other sites

Ok this is the error message:

 

MySQL Error

SQL statement: SELECT * FROM klantgegevens INNER JOIN rubrieken ON klantgegevens.Rubriek = rubrieken.RubriekID INNER JOIN groepen on rubrieken.GroepID = groepen.GroepID WHERE Rubriek = Array AND groepen.Groepnaam = 'Architect' ORDER BY Bedrijfsnaam

Error: Unknown column 'Array' in 'where clause'

 

Seems like it doesn't know what to do with "Array". I think in a working situation, instead of Array there should be the name of my checkbox (RubriekID)

Link to comment
Share on other sites

OK looks like when you check of the checkboxes it is creating an array so you can't do a search on that

try changing this

$bedrijfsnaam = isset($_GET['bedrijfsnaam']) ? $_GET['bedrijfsnaam'] : "default value";
$categorien = isset($_GET['categorien']) ? $_GET['categorien'] : "default value";
$provincie = isset($_GET['provincie']) ? $_GET['provincie'] : "default value";

 

To this

$bedrijfsnaam = isset($_GET['bedrijfsnaam']) ? $_GET['bedrijfsnaam'] : "default value";
$provincie = isset($_GET['provincie']) ? $_GET['provincie'] : "default value";
if(isset($_GET['categorien'])){
  if(is_array($_GET['categorien'])){
  $categorien = implode(", ", $_GET['categorien']);
  } else {
  $categorien = $_GET['categorien'];
  }
} else {
$categorien = "default value";
}

 

Then change the query from this

$sql = "SELECT * FROM klantgegevens INNER JOIN rubrieken ON klantgegevens.Rubriek = rubrieken.RubriekID INNER JOIN groepen on rubrieken.GroepID = groepen.GroepID WHERE Rubriek = ".$categorien." AND groepen.Groepnaam = 'Architect' ORDER BY Bedrijfsnaam  ";

 

To this

$sql = "SELECT * FROM klantgegevens INNER JOIN rubrieken ON klantgegevens.Rubriek = rubrieken.RubriekID INNER JOIN groepen on rubrieken.GroepID = groepen.GroepID WHERE Rubriek IN ('$categorien') AND groepen.Groepnaam = 'Architect' ORDER BY Bedrijfsnaam  ";

 

Let me know

 

Ray

Link to comment
Share on other sites

That is pretty cool Ray,

 

The Error: Unknown column 'Array' in 'where clause' is GONE  ;D.

 

And i'm able to search again, only not with several checkboxes at the same time. Its showing only the results of 1 checkbox. But this is a big step in the good direction!!

Link to comment
Share on other sites

Yep,

 

<tr><td>Rubriek:</td><td>'; 
$sql = "SELECT * FROM rubrieken INNER JOIN groepen ON rubrieken.GroepID = groepen.GroepID WHERE Groepnaam = 'Architect' ORDER BY Rubrieknaam "; 
    $result = mysql_query($sql) or die(mysql_error()); 
    while($query = mysql_fetch_array($result)) 
    { 
        if ($categorien == $query['RubriekID']) 
              echo '<input type="checkbox" name="categorien[]" value="'.$query['RubriekID'].'">'.$query['Rubrieknaam'].''; 
        else 
            echo '<input type="checkbox" name="categorien[]" value="'.$query['RubriekID'].'">'.$query['Rubrieknaam'].''; 
    } 
echo '</select></td></tr> 
<tr><td colspan="2"><input type="submit" value="zoeken"><input type="hidden" name="zoek" value="true"></td></tr> 

Link to comment
Share on other sites

need to move your end select tag up above your query

 

change this

tr><td>Provincie:</td><td><select name="provincie"><option value="">Selecteer...</option> <OPTION VALUE="Groningen">Groningen</OPTION> <OPTION VALUE="Friesland">Friesland</OPTION> <OPTION VALUE="Drenthe">Drenthe</OPTION> <OPTION VALUE="Overijssel">Overijssel</OPTION> <OPTION VALUE="Gelderland">Gelderland</OPTION> <OPTION VALUE="Utrecht">Utrecht</OPTION> <OPTION VALUE="Flevoland">Flevoland</OPTION> <OPTION VALUE="Noord-Holland">Noord-Holland</OPTION> <OPTION VALUE="Zuid-Holland">Zuid-Holland</OPTION> <OPTION VALUE="Noord-Brabant">Noord-Brabant</OPTION> <OPTION VALUE="Limburg">Limburg</OPTION> <OPTION VALUE="Zeeland">Zeeland</OPTION> </td></tr>

to this

tr><td>Provincie:</td>
<td>
<select name="provincie">
<option value="">Selecteer...</option> 
<OPTION VALUE="Groningen">Groningen</OPTION> 
<OPTION VALUE="Friesland">Friesland</OPTION> 
<OPTION VALUE="Drenthe">Drenthe</OPTION> 
<OPTION VALUE="Overijssel">Overijssel</OPTION> 
<OPTION VALUE="Gelderland">Gelderland</OPTION> 
<OPTION VALUE="Utrecht">Utrecht</OPTION>
<OPTION VALUE="Flevoland">Flevoland</OPTION> 
<OPTION VALUE="Noord-Holland">Noord-Holland</OPTION> 
<OPTION VALUE="Zuid-Holland">Zuid-Holland</OPTION> 
<OPTION VALUE="Noord-Brabant">Noord-Brabant</OPTION> 
<OPTION VALUE="Limburg">Limburg</OPTION> 
<OPTION VALUE="Zeeland">Zeeland</OPTION> 
</select>
</td></tr>

 

and change this

echo '</select></td></tr>

 

to this

echo '</td></tr>

 

Your checkboxes are in between the select tags

 

Ray

Link to comment
Share on other sites

try echo'ing out the query and see what it looks like

 

after this line, looks like it is in 2 places, add this in

$sql = "SELECT * FROM klantgegevens INNER JOIN rubrieken ON klantgegevens.Rubriek = rubrieken.RubriekID INNER JOIN groepen on rubrieken.GroepID = groepen.GroepID WHERE Rubriek = ".$categorien." AND groepen.Groepnaam = 'Architect' ORDER BY Bedrijfsnaam  ";
echo $sql."<br>";

 

also after you check the categorein, echo that also

$bedrijfsnaam = isset($_GET['bedrijfsnaam']) ? $_GET['bedrijfsnaam'] : "default value";
$provincie = isset($_GET['provincie']) ? $_GET['provincie'] : "default value";
if(isset($_GET['categorien'])){
  if(is_array($_GET['categorien'])){
  $categorien = implode(", ", $_GET['categorien']);
  } else {
  $categorien = $_GET['categorien'];
  }
} else {
$categorien = "default value";
}
echo $categorien;

 

Ray

 

 

 

 

 

Link to comment
Share on other sites

This is what its shows if i select 2 checkboxes:

 

SELECT * FROM klantgegevens INNER JOIN rubrieken ON klantgegevens.Rubriek = rubrieken.RubriekID INNER JOIN groepen on rubrieken.GroepID = groepen.GroepID WHERE Rubriek IN ('1, 6') AND groepen.Groepnaam = 'Architect' ORDER BY Bedrijfsnaam

 

The 1 and 6 stands for the rubriek ID, so in this example i've selected 2 checkboxes with the rubriekID 1 and 6.

 

And this example is when 1 checkbox is selected with the rubriekID is 1, which is working ok

SELECT * FROM klantgegevens INNER JOIN rubrieken ON klantgegevens.Rubriek = rubrieken.RubriekID INNER JOIN groepen on rubrieken.GroepID = groepen.GroepID WHERE Rubriek IN ('1') AND groepen.Groepnaam = 'Architect' ORDER BY Bedrijfsnaam

 

 

 

Link to comment
Share on other sites

lol damn I know what I forgot :)

 

change this line

$categorien = implode(", ", $_GET['categorien']);

 

to this

$categorien = implode("', '", $_GET['categorien']);

 

Have to have each one in single quotes

 

:)

 

Ray

 

Link to comment
Share on other sites

WHoooo you are the MAN!

 

Very thanks, this helped me so much. There are some other issues that i have, but i'm going to sort that out by myself first (at least i'm going to try). I hope i can ask you some questions in the future.

 

Thanks again!

 

Marcel

Link to comment
Share on other sites

Well i have another .php file wich is being called by this one. (I have to tell you that im not the one who is the author of this code, im trying to sort it out and change it to my wishes. But d..mn its pretty difficult).

 

I will post both, i understand if its to much code to sort out.

 

 

Link to comment
Share on other sites

Well i have another .php file wich is being called by this one. (I have to tell you that im not the one who is the author of this code, im trying to sort it out and change it to my wishes. But d..mn its pretty difficult).

 

I will post both, i understand if its to much code to sort out.

 

 

Link to comment
Share on other sites

Well i have another .php file wich is being called by this one. (I have to tell you that im not the one who is the author of this code, im trying to sort it out and change it to my wishes. But d..mn its pretty difficult).

 

I will post both, i understand if its to much code to sort out.

 


 

<?php
include("headerarchitect.php");



echo '<div id="content">';


if (isset($_GET['zoekletter']) || isset($_GET['zoek']))
{
if (isset($_GET['zoekletter']))
{
	echo 'gezocht op letter '.$_GET['zoekletter'].'<br><br>';

	$sql = "SELECT * FROM klantgegevens INNER JOIN rubrieken ON klantgegevens.Rubriek = rubrieken.RubriekID INNER JOIN groepen on rubrieken.GroepID = groepen.GroepID WHERE Bedrijfsnaam LIKE '".$_GET['zoekletter']."%' AND groepen.Groepnaam = 'Architect' ORDER BY Bedrijfsnaam ";
	$result = mysql_query($sql) or die(mysql_error()); 
	$query = mysql_num_rows($result);

	if ($query > 0)
	{
		if ($query < 15)
		{
			while($query = mysql_fetch_array($result))
			{
				$check = url_exists($server.'logos/'.$query['Portfolio'].'.jpg');
				if ($check == true)
					$imageurl = 'logos/'.$query['Portfolio'].'.jpg';
				else
					$imageurl = $default;



				echo '<table bgcolor="#ffffff" class="border1" onclick=window.open("http://www.bouwreferentie.nl/'.$query['Portfolio'].'")  style="cursor:pointer" onmouseover=style.borderColor="#13536e" onmouseout=style.borderColor="#5095bc" width="100%"><tr><td width="35%" rowspan="6" ><img src="'.$imageurl.'"></td><td width="15%">Bedrijfsnaam:</td><td width="50%">'.$query['Bedrijfsnaam'].'</td></tr>
				<tr><td width="15%">Adres:</td><td width="50%">'.$query['Straat'].' '.$query['Huisnummer'].' '.$query['Toevoeging'].'</td></tr>
				<tr><td width="15%">Postcode:</td><td width="50%">'.$query['Postcode'].'</td></tr>
				<tr><td width="15%">Provincie:</td><td width="50%">'.$query['Provincie'].'</td></tr>
				<tr><td width="15%">Rubriek:</td><td width="50%">'.$query['Rubrieknaam'].'</td></tr>
				<tr><td width="15%">Portfolio:</td><td width="50%"><a href="http://www.bouwreferentie.nl/'.$query['Portfolio'].'" target="_blanc">www.bouwreferentie.nl/'.$query['Portfolio'].'</a></td></tr>
				</table><br><br>';
			}
		}
		else
		{

			$numpages = ceil($count/$numresults); 	

			if (isset($_GET['page']))
				$page = $_GET['page'];
			else
				$page = 0;

			for ($i = 0; $i<$numpages; $i++)
			{
				echo '<a href="architecten.php?zoekletter='.$_GET['zoekletter'].'page='.$i.'">pag '.($i+1).'</a> || ';
			}
			echo '<br><br>';

			$sql = "SELECT * FROM klantgegevens INNER JOIN rubrieken ON klantgegevens.Rubriek = rubrieken.RubriekID INNER JOIN groepen on rubrieken.GroepID = groepen.GroepID WHERE Bedrijfsnaam LIKE '".$_GET['zoekletter']."%' AND groepen.Groepnaam = 'Architect' ORDER BY Bedrijfsnaam LIMIT ".($page*$numresults).", ".$numresults." ";
			$result = mysql_query($sql) or die(mysql_error()); 
			while($query = mysql_fetch_array($result))
			{
				$check = url_exists($server.'logos/'.$query['Portfolio'].'.jpg');
				if ($check == true)
					$imageurl = 'logos/'.$query['Portfolio'].'.jpg';
				else
					$imageurl = $default;

				echo '<table bgcolor="#ffffff" class="border1" onclick=window.open("http://www.bouwreferentie.nl/'.$query['Portfolio'].'")  style="cursor:pointer" onmouseover=style.borderColor="#13536e" onmouseout=style.borderColor="#5095bc" width="100%"><tr><td width="35%" rowspan="6" ><img src="'.$imageurl.'"></td><td width="15%">Bedrijfsnaam:</td><td width="50%">'.$query['Bedrijfsnaam'].'</td></tr>
				<tr><td width="15%">Adres:</td><td width="50%">'.$query['Straat'].' '.$query['Huisnummer'].' '.$query['Toevoeging'].'</td></tr>
				<tr><td width="15%">Postcode:</td><td width="50%">'.$query['Postcode'].'</td></tr>
				<tr><td width="15%">Provincie:</td><td width="50%">'.$query['Provincie'].'</td></tr>
				<tr><td width="15%">Rubriek:</td><td width="50%">'.$query['Rubrieknaam'].'</td></tr>
				<tr><td width="15%">Portfolio:</td><td width="50%"><a href="http://www.bouwreferentie.nl/'.$query['Portfolio'].'" target="_blanc">www.bouwreferentie.nl/'.$query['Portfolio'].'</a></td></tr>
				</table><br><br>';
			}
			echo '|| ';
			for ($i = 0; $i<$numpages; $i++)
			{
				echo '<a href="architecten.php?zoekletter='.$_GET['zoekletter'].'page='.$i.'">pag '.($i+1).'</a> || ';
			}

		}
	}
	else
	{
		echo 'Helaas geen bedrijven gevonden.';		
	}
}

if (isset($_GET['zoek']))
{
	//echo 'gezocht op woord '.$_GET['zoek'].'<br><br>';
	$first = true;

	if ($bedrijfsnaam != NULL)
	{
		$bedrijfsnaam = 'Bedrijfsnaam LIKE "%'.$bedrijfsnaam.'%" ';
		$first = false;
	}
	else
		$bedrijfsnaam = "";	

	if ($provincie != NULL)
	{	
		if ($first == false)
		{
			$provincie = 'AND Provincie LIKE "%'.$provincie.'%" ';	
		}
		else
			$provincie = 'Provincie LIKE "%'.$provincie.'%" ';		
		$first = false;
	}
	if (($categorien != "") && ($bedrijfsnaam == NULL) && ($provincie == NULL))
	{
		$categorie = true;
	}

	if (($first == false) || ($categorie == true))
	{
		if($categorien != "")
			$sql = "SELECT * FROM klantgegevens INNER JOIN rubrieken ON klantgegevens.Rubriek = rubrieken.RubriekID INNER JOIN groepen on rubrieken.GroepID = groepen.GroepID WHERE ".$bedrijfsnaam." ".$provincie." AND Rubriek = ".$categorien." AND groepen.Groepnaam = 'Architect' ORDER BY Bedrijfsnaam  ";
		else
			$sql = "SELECT * FROM klantgegevens INNER JOIN rubrieken ON klantgegevens.Rubriek = rubrieken.RubriekID INNER JOIN groepen on rubrieken.GroepID = groepen.GroepID WHERE ".$bedrijfsnaam." ".$provincie." AND groepen.Groepnaam = 'Architect' ORDER BY Bedrijfsnaam ";
		if ($categorie == true)
			$sql = "SELECT * FROM klantgegevens INNER JOIN rubrieken ON klantgegevens.Rubriek = rubrieken.RubriekID INNER JOIN groepen on rubrieken.GroepID = groepen.GroepID WHERE Rubriek = ".$categorien." AND groepen.Groepnaam = 'Architect' ORDER BY Bedrijfsnaam  ";

		$result = mysql_query($sql) or die(mysql_error()); 
		$query = mysql_num_rows($result);
		if ($query > 0)
		{
			if ($query < 15)
			{
				while($query = mysql_fetch_array($result))
				{
					$check = url_exists($server.'logos/'.$query['Portfolio'].'.jpg');
					if ($check == true)
						$imageurl = 'logos/'.$query['Portfolio'].'.jpg';
					else
						$imageurl = $default;

					echo '<table bgcolor="#ffffff" class="border1" onclick=window.open("http://www.bouwreferentie.nl/'.$query['Portfolio'].'")  style="cursor:pointer" onmouseover=style.borderColor="#13536e" onmouseout=style.borderColor="#5095bc" width="100%"><tr><td width="35%" rowspan="6" ><img src="'.$imageurl.'"></td><td width="15%">Bedrijfsnaam:</td><td width="50%">'.$query['Bedrijfsnaam'].'</td></tr>
				<tr><td width="15%">Adres:</td><td width="50%">'.$query['Straat'].' '.$query['Huisnummer'].' '.$query['Toevoeging'].'</td></tr>
				<tr><td width="15%">Postcode:</td><td width="50%">'.$query['Postcode'].'</td></tr>
				<tr><td width="15%">Provincie:</td><td width="50%">'.$query['Provincie'].'</td></tr>
				<tr><td width="15%">Rubriek:</td><td width="50%">'.$query['Rubrieknaam'].'</td></tr>
				<tr><td width="15%">Portfolio:</td><td width="50%"><a href="http://www.bouwreferentie.nl/'.$query['Portfolio'].'" target="_blanc">www.bouwreferentie.nl/'.$query['Portfolio'].'</a></td></tr>
				</table><br><br>';
				}
			}
			else
			{

				$numpages = ceil($query/$numresults);
				//echo 'num pages = '.$numpages; 	

				if (isset($_GET['page']))
					$page = $_GET['page'];
				else
					$page = 0;

				for ($i = 0; $i<$numpages; $i++)
				{
					echo '<a href="architecten.php?bedrijfsnaam='.$bedrijfsnaam.'&provincie='.$provincie.'&categorien='.$categorien.'&zoek=true&page='.$i.'">pag '.($i+1).'</a> || ';
				}
				echo '<br><br>';

				if($categorien != "")
			$sql = "SELECT * FROM klantgegevens INNER JOIN rubrieken ON klantgegevens.Rubriek = rubrieken.RubriekID INNER JOIN groepen on rubrieken.GroepID = groepen.GroepID WHERE ".$bedrijfsnaam." ".$provincie." AND Rubriek = ".$categorien." AND groepen.Groepnaam = 'Architect' ORDER BY Bedrijfsnaam LIMIT ".($page*$numresults).", ".$numresults."  ";
		else
			$sql = "SELECT * FROM klantgegevens INNER JOIN rubrieken ON klantgegevens.Rubriek = rubrieken.RubriekID INNER JOIN groepen on rubrieken.GroepID = groepen.GroepID WHERE ".$bedrijfsnaam." ".$provincie." AND groepen.Groepnaam = 'Architect' ORDER BY Bedrijfsnaam LIMIT ".($page*$numresults).", ".$numresults." ";
		if ($categorie == true)
			$sql = "SELECT * FROM klantgegevens INNER JOIN rubrieken ON klantgegevens.Rubriek = rubrieken.RubriekID INNER JOIN groepen on rubrieken.GroepID = groepen.GroepID WHERE Rubriek = ".$categorien." AND groepen.Groepnaam = 'Architect' ORDER BY Bedrijfsnaam LIMIT ".($page*$numresults).", ".$numresults."  ";

				$result = mysql_query($sql) or die(mysql_error()); 
				while($query = mysql_fetch_array($result))
				{
					$check = url_exists($server.'logos/'.$query['Portfolio'].'.jpg');
					if ($check == true)
						$imageurl = 'logos/'.$query['Portfolio'].'.jpg';
					else
						$imageurl = $default;

					echo '<table bgcolor="#ffffff" class="border1" onclick=window.open("http://www.bouwreferentie.nl/'.$query['Portfolio'].'")  style="cursor:pointer" onmouseover=style.borderColor="#13536e" onmouseout=style.borderColor="#5095bc" width="100%"><tr><td width="35%" rowspan="6" ><img src="'.$imageurl.'"></td><td width="15%">Bedrijfsnaam:</td><td width="50%">'.$query['Bedrijfsnaam'].'</td></tr>
				<tr><td width="15%">Adres:</td><td width="50%">'.$query['Straat'].' '.$query['Huisnummer'].' '.$query['Toevoeging'].'</td></tr>
				<tr><td width="15%">Postcode:</td><td width="50%">'.$query['Postcode'].'</td></tr>
				<tr><td width="15%">Provincie:</td><td width="50%">'.$query['Provincie'].'</td></tr>
				<tr><td width="15%">Rubriek:</td><td width="50%">'.$query['Rubrieknaam'].'</td></tr>
				<tr><td width="15%">Portfolio:</td><td width="50%"><a href="http://www.bouwreferentie.nl/'.$query['Portfolio'].'" target="_blanc">www.bouwreferentie.nl/'.$query['Portfolio'].'</a></td></tr>
				</table><br><br>';
				}
				echo '|| ';
				for ($i = 0; $i<$numpages; $i++)
				{
					echo '<a href="architecten.php?bedrijfsnaam='.$bedrijfsnaam.'&provincie='.$provincie.'&categorien='.$categorien.'&zoek=true&page='.$i.'">pag '.($i+1).'</a> || ';
				}

			}
		}
		else
		{
			echo 'Helaas geen bedrijven gevonden.';		
		}
	}
}
}
else
{
$sql = "SELECT * FROM klantgegevens INNER JOIN rubrieken ON klantgegevens.Rubriek = rubrieken.RubriekID INNER JOIN groepen on rubrieken.GroepID = groepen.GroepID WHERE groepen.Groepnaam = 'Architect' ORDER BY Bedrijfsnaam ";
$result = mysql_query($sql) or die(mysql_error()); 
$count = mysql_num_rows($result);
if ($count < 15)
{
	while($query = mysql_fetch_array($result))
	{
		$check = url_exists($server.'logos/'.$query['Portfolio'].'.jpg');
		if ($check == true)
			$imageurl = 'logos/'.$query['Portfolio'].'.jpg';
		else
			$imageurl = $default;

		echo '<table bgcolor="#ffffff" class="border1" onclick=window.open("http://www.bouwreferentie.nl/'.$query['Portfolio'].'")  style="cursor:pointer" onmouseover=style.borderColor="#13536e" onmouseout=style.borderColor="#5095bc" width="100%"><tr><td width="35%" rowspan="6" ><img src="'.$imageurl.'"></td><td width="15%">Bedrijfsnaam:</td><td width="50%">'.$query['Bedrijfsnaam'].'</td></tr>
				<tr><td width="15%">Adres:</td><td width="50%">'.$query['Straat'].' '.$query['Huisnummer'].' '.$query['Toevoeging'].'</td></tr>
				<tr><td width="15%">Postcode:</td><td width="50%">'.$query['Postcode'].'</td></tr>
				<tr><td width="15%">Provincie:</td><td width="50%">'.$query['Provincie'].'</td></tr>
				<tr><td width="15%">Rubriek:</td><td width="50%">'.$query['Rubrieknaam'].'</td></tr>
				<tr><td width="15%">Portfolio:</td><td width="50%"><a href="http://www.bouwreferentie.nl/'.$query['Portfolio'].'" target="_blanc">www.bouwreferentie.nl/'.$query['Portfolio'].'</a></td></tr>
				</table><br><br>';
	}
}
else
{

	$numpages = ceil($count/$numresults);
	//echo 'num pages = '.$numpages; 	

	if (isset($_GET['page']))
		$page = $_GET['page'];
	else
		$page = 0;

	for ($i = 0; $i<$numpages; $i++)
	{
		echo '<a href="architecten.php?page='.$i.'">pag '.($i+1).'</a> || ';
	}
	echo '<br><br>';

	$sql = "SELECT * FROM klantgegevens INNER JOIN rubrieken ON klantgegevens.Rubriek = rubrieken.RubriekID INNER JOIN groepen on rubrieken.GroepID = groepen.GroepID WHERE groepen.Groepnaam = 'Architect' ORDER BY Bedrijfsnaam LIMIT ".($page*$numresults).", ".$numresults." ";
	$result = mysql_query($sql) or die(mysql_error()); 
	while($query = mysql_fetch_array($result))
	{
		$check = url_exists($server.'logos/'.$query['Portfolio'].'.jpg');
		if ($check == true)
			$imageurl = 'logos/'.$query['Portfolio'].'.jpg';
		else
			$imageurl = $default;

		echo '<table bgcolor="#ffffff" class="border1" onclick=window.open("http://www.bouwreferentie.nl/'.$query['Portfolio'].'")  style="cursor:pointer" onmouseover=style.borderColor="#13536e" onmouseout=style.borderColor="#5095bc" width="100%"><tr><td width="35%" rowspan="6" ><img src="'.$imageurl.'"></td><td width="15%">Bedrijfsnaam:</td><td width="50%">'.$query['Bedrijfsnaam'].'</td></tr>
				<tr><td width="15%">Adres:</td><td width="50%">'.$query['Straat'].' '.$query['Huisnummer'].' '.$query['Toevoeging'].'</td></tr>
				<tr><td width="15%">Postcode:</td><td width="50%">'.$query['Postcode'].'</td></tr>
				<tr><td width="15%">Provincie:</td><td width="50%">'.$query['Provincie'].'</td></tr>
				<tr><td width="15%">Rubriek:</td><td width="50%">'.$query['Rubrieknaam'].'</td></tr>
				<tr><td width="15%">Portfolio:</td><td width="50%"><a href="http://www.bouwreferentie.nl/'.$query['Portfolio'].'" target="_blanc">www.bouwreferentie.nl/'.$query['Portfolio'].'</a></td></tr>
				</table><br><br>';
	}
	echo '|| ';
	for ($i = 0; $i<$numpages; $i++)
	{
		echo '<a href="architecten.php?page='.$i.'">pag '.($i+1).'</a> || ';
	}

}
}

include("footer.php");

?>

 

 

Link to comment
Share on other sites

Well i have another .php file wich is being called by this one. (I have to tell you that im not the one who is the author of this code, im trying to sort it out and change it to my wishes. But d..mn its pretty difficult).

 

I will post both, i understand if its to much code to sort out.

 


 

?>

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.