php.de

Zurück   php.de > Webentwicklung > PHP Einsteiger > PHP Tipps 2008

 
 
LinkBack Themen-Optionen Thema bewerten
Alt 28.12.2008, 19:32  
Benutzer
 
Registriert seit: 28.12.2008
Beiträge: 92
mastertnt befindet sich auf einem aufstrebenden Ast
Standard 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
mastertnt ist offline  
Sponsor Mitteilung
PHP Code Flüsterer

Registriert seit: 21.08.2005
Beiträge: 4682
PHP-Kenntnisse:
Fortgeschritten

Alt 28.12.2008, 19:39  
Erfahrener Benutzer
 
Registriert seit: 28.03.2008
Beiträge: 1.847
HPR1974 wird schon bald berühmt werden
Standard

und dein sql haste Dir schon ausgeben lassen?
HPR1974 ist offline  
Alt 28.12.2008, 21:12  
Benutzer
 
Registriert seit: 28.12.2008
Beiträge: 92
mastertnt befindet sich auf einem aufstrebenden Ast
Standard

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
mastertnt ist offline  
Alt 28.12.2008, 21:37  
Erfahrener Benutzer
 
Registriert seit: 19.03.2007
Beiträge: 176
BlackWolf ist zur Zeit noch ein unbeschriebenes Blatt
Standard

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
BlackWolf ist offline  
Alt 29.12.2008, 12:16  
Benutzer
 
Registriert seit: 28.12.2008
Beiträge: 92
mastertnt befindet sich auf einem aufstrebenden Ast
Standard

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
mastertnt ist offline  
 


Themen-Optionen
Thema bewerten
Thema bewerten:

Forumregeln
Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are an
Gehe zu

Ähnliche Themen
Thema Autor Forum Antworten Letzter Beitrag
Suche Mitarbeiter für Feuerwehr / Polizei & Rettungsdienst Browsergame.. h3nny Beitragsarchiv 9 01.02.2009 14:56
Problem mit foren suche programmieren! litterauspirna PHP Tipps 2008 4 17.08.2008 12:17
Verbesserungsvorschläge: Design und Suche Manko10 Board-Support 3 15.06.2008 16:21
Suche 'strahlfreudigen' Router nikosch Off-Topic Diskussionen 6 22.01.2008 19:06
Suche in Office Dateien mit Index Beatbox Off-Topic Diskussionen 6 09.02.2007 15:34
Suche Alienuser PHP Tipps 2006 5 02.07.2006 16:31
suche funktion: suche alles zwischen notyyy PHP Tipps 2006 7 05.06.2006 20:46
[Erledigt] Erweiterung der Suche PHP Tipps 2007 2 01.12.2005 19:30
Suche in Datenbank realisieren Unbekanntes_Pferd PHP Tipps 2007 4 09.11.2005 16:22
suche lösungsweg für komplexe suche, md5hash PHP Tipps 2005-2 3 19.07.2005 17:57
stichwort suche boehseronkel Datenbanken 2 14.07.2005 09:28
mal wieder eine suche lomtas Datenbanken 0 12.07.2005 11:03
Suche Job als Entwickler/Designer (Raum Bonn o. Telearbeit) Beitragsarchiv 23 01.03.2005 14:00
Suche mehrere Images........ Beitragsarchiv 7 10.01.2005 08:07

Besucher kamen über folgende Suchanfragen bei Google auf diese Seite
plz suche ausland, ausland plz suche, jobportal spanien, php jobportal, plz suchen ausland, php select, auslands plz suchen, jobportal script

Alle Zeitangaben in WEZ +2. Es ist jetzt 18:19 Uhr.




Powered by vBulletin® Version 3.7.2 (Deutsch)
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
Aprilia-Forum, Aquaristik-Forum, Liebeskummer-Forum, Zierfisch-Forum, Geizkragen-Forum