Ankündigung

Einklappen
Keine Ankündigung bisher.

PLZ Suche in Jobportal

Einklappen

Neue Werbung 2019

Einklappen
X
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • PLZ Suche in Jobportal

    Hallo zusammen,

    ich bastel grade an einem Job Portal script, doch leider funktioniert die Suche nicht so ganz.

    Es gibt 5 Länder zur Auswahl und 11 PLZ Gebiete 0 -9 + Ausland zur Auswahl.

    Zur Zeit ist es so, dass die Beschränkung auf die PLZ Gebiete nicht funktioniert. Man wählt Deutschland aus und Gebiet 2xxxx und er spuckt alle aus ganz Deutschland aus.

    Ich poste hier mal ein paar Dateien die von Bedeutung sind

    conn.php
    PHP-Code:
    function select_country($c$n)
    {
        
    $s "<select name=\"$n\">\n\t";

        
    $countries $countries = array('Deutschland''Spanien''Österreich''Schweiz''Türkei');

        while(list(,
    $v) = each($countries))
        {
            if(!empty(
    $c))
            {
                if(
    $c == $v)
                {
                    
    $s .= "<option value=\"$v\" selected>$v</option>\n\t";
                }
                else
                {
                    
    $s .= "<option value=\"$v\">$v</option>\n\t";
                }
            }
            else
            {
                if(
    $v == "USA")
                {
                    
    $s .= "<option value=\"$v\" selected>$v</option>\n\t";
                }
                else
                {
                    
    $s .= "<option value=\"$v\">$v</option>\n\t";
                }
            }
        }

        
    $s .= "</select>\n\n";

        return 
    $s;
    }

    function 
    target_company($t) {
      
      
    $tarray = array("Ausland""0xxxx""1xxxx""2xxxx""3xxxx""4xxxx""5xxxx""6xxxx""7xxxx""8xxxx""9xxxx");
      
      
      
    $select '<select name="target_company">';

      while(list(
    $k,$v) = each($tarray))
      {
        
    $selected $t===$v 'selected="selected" ' '';
        
    $select .= "\n\t<option $selected>$v</option>";
      }
      
    $select .= "\n</select>";

      return 
    $select;

    Jetzt die arbeitgeber suche
    employersearch
    PHP-Code:
    $tc = target_company("", "");
    $target_company = str_replace("<select name=\"target_company\">", "<select name=\"target_company\"><option value=\"\">Alle</option>", $tc);

    $country = select_country("", "country");
    $select_country = str_replace("<select name=\"country\">", "<select name=\"country\"><option value=\"\">Alle</option>", $country);
    $select_country = str_replace("<option value=\"Thailand\" selected>", "<option value=\"Thailand\">", $select_country);


    //Daten aus dem Formular
    </tr>
    <tr>
        <td align=right>Land: </td>
        <td><?=$select_country?></td>
    </tr>

    <tr>
        <td align=right>Plz Gebiet (DE):</td>

        <td><?=$target_company?></td>
    </tr>
    jetzt die datei die sucht search2.php
    PHP-Code:
    if(!empty($_POST))
    {
        
    extract($_POST);
    }

    if(!empty(
    $_GET))
    {
        
    extract($_GET);
    }

    $sch = array(); 
    if (!empty(
    $JobCategory)) 
    {
        
    $sch[] = "job_category like '%$JobCategory%'";
    }
    if (!empty(
    $careerlevel)) 
    {
        
    $sch[] = "careerlevel = \"$careerlevel\" ";
    }
    if (!empty(
    $target_company)) 
    {
        
    $sch[] = "target_company = \"$target_company\" ";
    }
    if (!empty(
    $relocate)) 
    {
        
    $sch[] = "relocate = \"$relocate\" ";
    }
    if (!empty(
    $country)) 
    {
        
    $sch[] = "country = \"$country\" ";
    }
    if (!empty(
    $city)) 
    {
        
    $sch[] = "city like '%$city%'";
    }
    if (!empty(
    $state)) 
    {
        
    $sch[] = "state = \"$state\" ";
    }

    if(!empty(
    $nationality))
    {
        
    $sch[] = "nationality = \"$nationality\" ";
    }

    if(!empty(
    $sex))
    {
        
    $sch[] = "sex = \"$sex\" ";
    }

    if(!empty(
    $income))
    {
        
    $sch[] = "income = \"$income\" ";
    }

    if(!empty(
    $maritalstatus))
    {
        
    $sch[] = "maritalstatus = \"$maritalstatus\" ";
    }

    if(!empty(
    $age))
    {
        
    $ny date(Y);

        
    $sch[] = " ('$ny' - byear) < '$age' ";
    }

    if (!empty(
    $kw)) 
    {
        
    $sch[] = "rTitle like '%$kw%' or rPar like '%$kw%' ";
    }

    if (!
    $ByPage$ByPage=5;  
    if (!
    $Start$Start=0

    if(
    $sm == 'or')
    {
        
    $qs "select * from job_seeker_info ".(($sch)?"where ".join(" or "$sch):"")." limit $Start,$ByPage";
        
    $qss "select * from job_seeker_info ".(($sch)?"where ".join(" or "$sch):"");
    }
    elseif(
    $sm == 'and')
    {
        
    $qs "select * from job_seeker_info ".(($sch)?"where ".join(" and "$sch):"")." limit $Start,$ByPage";
        
    $qss "select * from job_seeker_info ".(($sch)?"where ".join(" and "$sch):"");
    }
    $rqs mysql_query($qs) or die(mysql_error());

    $rqss mysql_query($qss) or die(mysql_error());
    $rr mysql_num_rows($rqss); 
    nun die datei arbeinehmer jobsuche
    PHP-Code:
    $country = select_country("", "country");
    $select_country = str_replace("<select name=\"country\">", "<select name=\"country\"><option value=\"\">Alle</option>", $country);
    $select_country = str_replace("<option value=\"Thailand\" selected>", "<option value=\"Thailand\">", $select_country);

    $tc = target_company("");
    $target_company = str_replace("<select name=\"target_company\">", "<select name=\"target_company\"><option value=\"\">Alle</option>", $tc);

    <tr>
            <td align=right><b>Land: </b></td>
            
        <td><?=$select_country?></td>
    </tr>

    <tr>
            <td align=right><b>PLZ Bereich: </b></td>
            <td><?=$target_company?></td>
    </tr>
    nun die letze die diese suche einleitet
    PHP-Code:
    if(!empty($_POST))
    {
        
    extract($_POST);
    }

    if(!empty(
    $_GET))
    {
        
    extract($_GET);
    }

    $sch = array(); 
    if (!empty(
    $position)) 
    {
    $sch[] = "position like '%$position%'";
    }
    if (!empty(
    $country)) 
    {
    $sch[] = "CompanyCountry = \"$country\" ";
    }
    if (!empty(
    $state))
    {
    $sch[] = "CompanyState = '$state' "
    }
    if (!empty(
    $JobCategory)) 
    {
    $sch[] = "JobCategory like '%$JobCategory%' "
    }
    if (!empty(
    $careerlevel))
    {
    $sch[] = "j_target = '$careerlevel'"
    }
    if (!empty(
    $kw))
    {
    $sch[] = "description like '%$kw%'"
    }
    if (!empty(
    $target_company)) 
    {
        
    $sch[] = "target_company = \"$target_company\" ";
    }


    if (!
    $ByPage$ByPage=25;  
    if (!
    $Start$Start=0

    if(empty(
    $sm))
    {
        
    $sm "and";
    }

    if(
    $sm == 'or')
    {
    $qs "select * from job_post ".(($sch)?"where ".join(" or "$sch):"")." limit $Start,$ByPage";
    $qss "select * from job_post ".(($sch)?"where ".join(" or "$sch):"");
    }
    elseif(
    $sm == 'and')
    {
    $qs "select * from job_post ".(($sch)?"where ".join(" and "$sch):"")." limit $Start,$ByPage";
    $qss "select * from job_post ".(($sch)?"where ".join(" and "$sch):"");
    }
    $rqs mysql_query($qs) or die(mysql_error());
    $rqss mysql_query($qss) or die(mysql_error());

    $rr mysql_num_rows($rqss); 

    Hoffe mir kann da jemand helfen bin echt am verzweifeln....


    Lieben gruss

    marcel

  • #2
    und dein sql haste Dir schon ausgeben lassen?

    Kommentar


    • #3
      das steht im unteren teil drinn.

      die suche nach ländern funktioniert ja auch nur die Zuordnung der PLZ bereiche funzt nicht hmm

      PHP-Code:
      if(empty($sm)) 

          
      $sm "and"


      if(
      $sm == 'or'

      $qs "select * from job_post ".(($sch)?"where ".join(" or "$sch):"")." limit $Start,$ByPage"
      $qss "select * from job_post ".(($sch)?"where ".join(" or "$sch):""); 

      elseif(
      $sm == 'and'

      $qs "select * from job_post ".(($sch)?"where ".join(" and "$sch):"")." limit $Start,$ByPage"
      $qss "select * from job_post ".(($sch)?"where ".join(" and "$sch):""); 

      $rqs mysql_query($qs) or die(mysql_error()); 
      $rqss mysql_query($qss) or die(mysql_error()); 

      $rr mysql_num_rows($rqss); 
      danke für deine schnelle antwort

      gruss

      marcel

      Kommentar


      • #4
        Ich glaube er meinte deine WIRKLICHE sql-query. also das, was WIRKLICH an die datenbank gesendet wird.
        oder anders gesagt: was gibt
        echo $rqs;
        und
        echo $rqss;
        aus?

        mfg

        Kommentar


        • #5
          ahh okay sorry habe ich wohl falsch verstanden...

          hier meine komplette

          jobsearch2.php hier ist auch die ausgabe drin.

          ich glaube es liegt bestimmt daran dass irgendwo ne if anweisung mit einer suche der plz bereiche eingebaut werden muss...

          *grübel*
          PHP-Code:
          if(!empty($_POST))
          {
              
          extract($_POST);
          }

          if(!empty(
          $_GET))
          {
              
          extract($_GET);
          }

          $sch = array(); 
          if (!empty(
          $position)) 
          {
          $sch[] = "position like '%$position%'";
          }
          if (!empty(
          $country)) 
          {
          $sch[] = "CompanyCountry = \"$country\" ";
          }
          if (!empty(
          $state))
          {
          $sch[] = "CompanyState = '$state' "
          }
          if (!empty(
          $JobCategory)) 
          {
          $sch[] = "JobCategory like '%$JobCategory%' "
          }
          if (!empty(
          $careerlevel))
          {
          $sch[] = "j_target = '$careerlevel'"
          }
          if (!empty(
          $kw))
          {
          $sch[] = "description like '%$kw%'"
          }
          if (!empty(
          $target_company)) 
          {
              
          $sch[] = "target_company = \"$target_company\" ";
          }


          if (!
          $ByPage$ByPage=25;  
          if (!
          $Start$Start=0

          if(empty(
          $sm))
          {
              
          $sm "and";
          }

          if(
          $sm == 'or')
          {
          $qs "select * from job_post ".(($sch)?"where ".join(" or "$sch):"")." limit $Start,$ByPage";
          $qss "select * from job_post ".(($sch)?"where ".join(" or "$sch):"");
          }
          elseif(
          $sm == 'and')
          {
          $qs "select * from job_post ".(($sch)?"where ".join(" and "$sch):"")." limit $Start,$ByPage";
          $qss "select * from job_post ".(($sch)?"where ".join(" and "$sch):"");
          }
          $rqs mysql_query($qs) or die(mysql_error());
          $rqss mysql_query($qss) or die(mysql_error());

          $rr mysql_num_rows($rqss);

          if(
          $rr == '0')
          {
              echo 
          "<br><br><center><span class=TNA>Keine Ergebnisse gefunden.</span></center>";
              include_once(
          '../footer.php');
              exit;
          }
          elseif(
          $rr == '1')
          {
              echo 
          "<br><center><span class=HeaderClass>Ihre Suche ergab einen Treffer.</span></center>";
          }
          elseif(
          $rr '1')
          {
              echo 
          "<br><center><span class=HeaderClass>Ihr Suche ergab $rr Treffer.</span></center>";
          }

          $col "cococo"

          echo 
          "<table align=center width=460 cellspacing=0 class=BlackText>
              <tr class=TableHead>
                  <td width=220>Position </td><td width=190>Job Kategorien </td><td width=60 align=center>Endet in</td></tr>"
          ;

          while(
          $as mysql_fetch_array($rqs))
          {
              
          //$ex13 = date('d', mktime(0,0,0, $as[EXmonth] - date(m), $as[EXday] - date(d),  $as[EXyear] - date(Y)));

              
          $day date(d);
              
          $month date(m);
              
          $year date(Y);

              
          $EXdate "$as[EXyear]"."-"."$as[EXmonth]"."-"."$as[EXday]";
              
          $dnes "$year"."-"."$month"."-"."$day";

              
          $qd "select to_days('$EXdate') - to_days('$dnes')";
              
          $rqd mysql_query($qd) or die(mysql_error());
              
          $ex13 mysql_fetch_array($rqd);

               if(
          $col == "cococo")
                  { 
                   
          $col "dddddd"
                  }
                            else
                  { 
                  
          $col "cococo"
                  } 
              echo 
          "<tr bgcolor=\"$col\">
                  <td><a class=BlackLink href=\"JobInfo.php?job_id=
          $as[job_id]\">  $as[position] PLZ $as[plz] </a></td><td> $as[JobCategory] </td><td align=center><b> $ex13[0] Tagen</b></td>
                      </tr>"
          ;
          }


          if(
          $sm == 'or')
          {
          $qs2 "select * from job_post ".(($sch)?"where ".join(" or "$sch):"");
          }
          elseif(
          $sm == 'and')
          {
          $qs2 "select * from job_post ".(($sch)?"where ".join(" and "$sch):"");
          }
          $rqs2 mysql_query($qs2) or die(mysql_error());
          $rr2 mysql_num_rows($rqs2);

          echo 
          "</table>";

          echo 
          "<table width=470 align=center><tr>";


              if (
          $rr2 <= $ByPage && $Start == '0')
              {

              }

              if ( 
          $Start )
              {
                  
          $nom1 $Start $ByPage;
                  echo 
          "<td align=left><a class=TNA href=\"JobSearch3.php?sm=$sm&position=$position&CompanyCountry=$CompanyCountry&CompanyState=$CompanyState&JobCategory=$JobCategory&careerlevel=$careerlevel&target_company=$target_company&relocate=$relocate&country=$country&city=$city&kw=$kw&Start=$nom1\">previous</a></td>";
              }

              if (
          $rr2 $Start $ByPage  || ($Start == && $rr2 $ByPage))
              {
                  
          $nom $Start $ByPage;
                  echo 
          "<td align=right><a class=TNA href=\"JobSearch3.php?sm=$sm&position=$position&CompanyCountry=$CompanyCountry&CompanyState=$CompanyState&JobCategory=$JobCategory&careerlevel=$careerlevel&target_company=$target_company&relocate=$relocate&country=$country&city=$city&kw=$kw&Start=$nom\">next</a></td>";
              }

          echo 
          "</tr></table>";


          ?> 
          Danke für Eure schnelle Hilfe im Voraus

          Gruss

          Marcel

          Kommentar

          Lädt...
          X