WCM - Das österreichische Computer Magazin Forenübersicht
 

Zurück   WCM Forum > Rat & Tat > Programmierung

Programmierung Rat & Tat für Programmierer

Microsoft KARRIERECAMPUS

Antwort
 
Themen-Optionen Ansicht
Alt 09.02.2005, 13:12   #1
reichr
Veteran
 
Registriert seit: 31.12.2002
Beiträge: 390


reichr eine Nachricht über ICQ schicken
Standard PHP Suchscript

folgendes problem bei unterem script!
bei der such zB feld name und vname werden mir nicht alle datensätze der angegebenen suchanforderung ausgeworfen!

PHP-Code:
<?php
require("config.inc.php");

echo 
"<font face=\"verdana\">";
//######## Suchwörter ###############################################
if ($_REQUEST['send']=="Suchen") {
 
$findname=$_POST['sfindname'];
 
$findvname=$_POST['sfindvname'];
 
$findstr=$_POST['sfindstr'];
 
$findhnr=$_POST['sfindhnr'];
 
$findplz=$_POST['sfindplz'];
 
$findort=$_POST['sfindort'];
}
elseif (
$_REQUEST['send']=="Alle") {
 
$findname="";
 
$findvname="";
 
$findstr="";
 
$findhnr="";
 
$findplz="";
 
$findort="";
}
else {
$findname=$_SESSION['findname'];
$findname=$_SESSION['findvname'];
$findstr=$_SESSION['findstr'];
$findhnr=$_SESSION['findhnr'];
$findplz=$_SESSION['findplz'];
$findort=$_SESSION['findort'];
}
if (
$findname  == ""$findname  "%";
if (
$findvname  == ""$findvname  "%";
if (
$findstr  == ""$findstr  "%";
if (
$findhnr  == ""$findhnr  "%";
if (
$findplz  == ""$findplz  "%";
if (
$findort  == ""$findort  "%";

$_SESSION['findname']=$findname;
$_SESSION['findvname']=$findvname;
$_SESSION['findstr']=$findstr;
$_SESSION['findhnr']=$findhnr;
$_SESSION['findplz']=$findplz;
$_SESSION['findort']=$findort;
//############ Kunden  anzeigen ################################################


echo "<title>$shoptitel - Kunden</title>";
echo 
"<table border=\"0\" cellspacing=\"1\" cellpadding=\"3\" width=\"100%\">
      <tr>
      <td>KdNr</td>
         <td>Name</td>
         <td>Vorname</td>
         <td>Str</td>
         <td>Haus Nr</td>
         <td>PLZ</td>
         <td>Ort</td>
         <td>Ed</td>
       </tr>
       <tr>
       <td></td>
         <td><form action=\"index.php\" method=\"post\">
         <input name=\"sfindname\" value=\"$findname\"></td>
         <td><input name=\"sfindvname\" value=\"$findvname\"></td>
         <td><input name=\"sfindstr\" value=\"$findstr\"></td>
         <td><input name=\"sfindhnr\" value=\"$findhnr\"></td>
         <td><input name=\"sfindplz\" value=\"$findplz\"></td>
         <td><input name=\"sfindort\" value=\"$findort\"></td>
         <td colspan=\"2\"><input type=submit name=send value=Suchen></td>
       </tr>"
;

$eintrag=$_REQUEST['eintrag'];
switch (
$eintrag) {
   case 
"";
     
$eintrag "0";
   };
if (
$_REQUEST['send']=="Suchen") {
$sqlbefehl"Select * FROM kunden2
             where Col002 like '%$findname%'
             and Col004 like '%$findvname%'
             and Col006 like '%$findstr%'
             and Col008 like '%$findhnr%'
             and Col010 like '%$findplz%'
             and Col012 like '%$findort%'
             order by Col002, Col004, Col012"
;

$getuser  mysql_query($sqlbefehl$serverid);
while ( 
$showuser mysql_fetch_array($getuser)) {
if (
$tdclass == "#ffffff") { $tdclass="#cococo"; }
else  { 
$tdclass="#ffffff"; }
     echo 
"<tr>
            <td bgcolor=\"$tdclass\">"
.stripslashes($showuser[kdnr])."</td>
            <td bgcolor=\"$tdclass\">"
.stripslashes($showuser[Col002])."</td>
            <td bgcolor=\"$tdclass\">"
.stripslashes($showuser[Col004])."</td>
            <td bgcolor=\"$tdclass\">"
.stripslashes($showuser[Col006])."</td>
            <td bgcolor=\"$tdclass\">"
.stripslashes($showuser[Col008])."</td>
            <td bgcolor=\"$tdclass\">"
.stripslashes($showuser[Col010])."</td>
            <td bgcolor=\"$tdclass\">"
.stripslashes($showuser[Col012])."</td>
          <td>
        </td>
     </tr>"
;

}  }

echo 
"<tr><td colspan=\"5\">
       </td></tr>
     </table>"
;?>

hier die datenbank-struktur


CREATE TABLE `kunden2` (
`kdnr` varchar(255) NOT NULL default '',
`Col002` varchar(255) default NULL,
`Col003` varchar(255) default NULL,
`Col004` varchar(255) default NULL,
`Col005` varchar(255) default NULL,
`Col006` varchar(255) default NULL,
`Col007` varchar(255) default NULL,
`Col008` varchar(255) default NULL,
`Col009` varchar(255) default NULL,
`Col010` varchar(255) default NULL,
`Col011` varchar(255) default NULL,
`Col012` varchar(255) default NULL,
`Col013` varchar(255) default NULL,
`Col014` varchar(255) default NULL,
`Col015` varchar(255) default NULL,
PRIMARY KEY (`kdnr`),
KEY `kdnr` (`kdnr`)
) TYPE=MyISAM;



vielleicht fällt euch was dazu ein?!
____________________________________
lg


Chris
reichr ist offline   Mit Zitat antworten
Alt 09.02.2005, 13:43   #2
T.dot
Master
 
Registriert seit: 13.08.2003
Beiträge: 624


Standard

Wie wärst wennst du den Spalten mal sinnvolle Namen gibts? ColXXX ist ziemlich nichts-sagend.

Lass dir einfach mal das sql-statement ausgeben und schau, was drinnsteht...

das gefällt mir übrigens auch nicht:
echo "<title>$shoptitel - Kunden</title>";
echo "<table border=\"0\" cellspacing=\"1\" cellpadding=\"3\"
....

ein <title>... gehört in den Head und nicht im Body (wobei ich hoffe du hast irgendwo head und body )

mfg Thomas
T.dot ist offline   Mit Zitat antworten
Alt 09.02.2005, 20:09   #3
AlexanderFX
Veteran
 
Registriert seit: 23.01.2003
Alter: 39
Beiträge: 224


AlexanderFX eine Nachricht über ICQ schicken
Standard

solltest du ned als id eine Integer variable nehmen?
bzw in deinem fall die kundennr

außerdem fehlt dir ein </font> wenn ich mich ned irre

sonst empfehle ich das gleiche wie thomas: sql kommando ausgeben und checken
AlexanderFX ist offline   Mit Zitat antworten
Antwort


Aktive Benutzer in diesem Thema: 1 (Registrierte Benutzer: 0, Gäste: 1)
 

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

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.

Gehe zu


Alle Zeitangaben in WEZ +2. Es ist jetzt 00:35 Uhr.


Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Forum SEO by Zoints
© 2009 FSL Verlag