CronJob-Service
bei SELFPHP mit ...
|
+ minütlichen Aufrufen
+ eigenem Crontab Eintrag
+ unbegrenzten CronJobs
+ Statistiken
+ Beispielaufrufen
+ Control-Bereich
Führen Sie mit den CronJobs von
SELFPHP zeitgesteuert Programme
auf Ihrem Server
aus. Weitere Infos
|
:: Anbieterverzeichnis ::
Globale Branchen
Informieren Sie sich über ausgewählte Unternehmen im Anbieterverzeichnis von SELFPHP
:: Newsletter ::
Abonnieren Sie hier den kostenlosen
SELFPHP Newsletter!
|
PHP Grundlagen Hier kann über grundlegende Probleme oder Anfängerschwierigkeiten diskutiert werden |
28.09.2006, 20:49:05
|
|
Anfänger
|
|
Registriert seit: Sep 2006
Beiträge: 11
|
|
AW: php-skript wird auf hosteurope nicht gefunden
na gut, hast ja recht...
also __00.php:
PHP-Code:
<?php
define("_HST", "localhost");
define("_USR", "dbu1001206");
define("_PWD", "wwfabdb0");
define("_DTB", "db1001206-fab");
$db = new mysql_db;
class mysql_db {
var $fLinked = false;
var $fResID = false;
var $fError = false;
var $sHost;
var $sUser;
var $sPwd;
var $sDB;
/** Verbindet mit der DB **/
function connect() {
$temp = 0;
$temp = @mysql_Connect
($this -> sHost, $this->sUser, $this->sPwd);
if (!$temp) {
$this->ErrorMsg();
return false;
}
$this->fLinked = $temp;
$temp = @mysql_select_db($this->sDB, $temp);
if (!$temp) {
$this->ErrorMsg();
return false;
}
return $this->fLinked;
}
function SetError($fErrorValue) { $this->fError = $fErrorValue; }
/** Setzt SQL-Statement an die DB ab **/
function query($sSql) {
if (!$this->fLinked) {
if ($this->fError) {
echo ("<b>Nicht verbunden.</b><br>");
return false;
}
}
if ($this->fResID) @mysql_free_result($this->fResID);
$result = mysql_Query($sSql, $this->fLinked);
if (!$result) $this->ErrorMsg();
$this->fResID = $result;
return $result;
}
/** Liefert Ergebnismenge **/
function data() {
if (!$this->fLinked) {
if ($this->fError) {
echo ("<b>Nicht verbunden!</b><br />");
return false;
} }
if (!$this->fResID) {
if ($this->fError) {
echo ("<b>Keine Abfrage!</b><br />");
return false;
} }
$result = mysql_fetch_array($this->fResID, MYSQL_BOTH);
$this->ErrorMsg();
return $result;
}
/** SQL-Fehlermeldung **/
function ErrorMsg() {
if (!$this->fError) return;
if (!mysql_errno()) return;
echo ("<br /><font color=\"red\"><b>".mysql_errno());
echo (": ".mysql_error()."</b></font><br /><br />");
}
/** Basis-Konstruktor, verbindet bei Instanziierung **/
function mysql_db() {
if ($_SERVER["SERVER_ADDR"]=="127.0.0.1") { # lokal
$this->sHost = "localhost";
$this->sUser = "root";
$this->sPwd = "";
$this->sDB = "mwfa";
} else {
$this->sHost = _HST;
$this->sUser = _USR;
$this->sPwd = _PWD;
$this->sDB = _DTB;
}
$this->connect();
}
};
?>
und das suchskript __13.php:
PHP-Code:
<?
class cSuche {
var $rubrik;
var $rid;
var $urubrik;
var $uid;
var $ort;
var $onr;
var $sstr;
var $arFid;
var $arErg;
var $arPlz;
/** Konstruktor, liest die Suchkriterien ein **/
function cSuche(&$db, $r, $u, $o, $s) {
$this->rid = $r; $this->uid = $u;
$db->query("SELECT rname FROM t_rubrik WHERE rid='".$r."';");
while (list($x1) = $db->data()) { $this->rubrik = $x1; }
if ($this->rubrik == "") { $this->rubrik = "Alle Rubriken"; }
$db->query("SELECT uname FROM t_urubrik WHERE uid='".$u."';");
while (list($x1) = $db->data()) { $this->urubrik = $x1; }
if ($this->urubrik == "") { $this->urubrik = "Alle Unterrubriken"; }
switch ($o) {
case "00": $this->ort = "Alle Standorte"; $this->onr = -1; break;
case "10": $this->ort = "0.... (Deutschland)"; $this->onr = 0; break;
case "11": $this->ort = "1.... (Deutschland)"; $this->onr = 1; break;
case "12": $this->ort = "2.... (Deutschland)"; $this->onr = 2; break;
case "13": $this->ort = "3.... (Deutschland)"; $this->onr = 3; break;
case "14": $this->ort = "4.... (Deutschland)"; $this->onr = 4; break;
case "15": $this->ort = "5.... (Deutschland)"; $this->onr = 5; break;
case "16": $this->ort = "6.... (Deutschland)"; $this->onr = 6; break;
case "17": $this->ort = "7.... (Deutschland)"; $this->onr = 7; break;
case "18": $this->ort = "8.... (Deutschland)"; $this->onr = 8; break;
case "19": $this->ort = "9.... (Deutschland)"; $this->onr = 9; break;
case "20": $this->ort = "Österreich"; $this->onr = -2; break;
case "30": $this->ort = "Schweiz"; $this->onr = -3; break;
}
$this->sstr = $s;
$this->$arFid = array(); $this->$arErg = array(); $this->$arPlz = array();
return 1;
}
/** Durchsucht Datenbank und sortiert das Ergebnis **/
function suchen(&$db, $sort, $updn) {
$eid = array();
/**
** Erstelle Ergebnismenge mit Filterung bzw. ohne Filterung
**/
if ($this->rid > 0) { # Rubrik gewaehlt
if ($this->uid > 0) { # und Unterrubrik gewaehlt
$db->query("SELECT eid FROM t_belegung WHERE rid='".$this->rid."' AND uid='".$this->uid."';");
} else { # und alle Unterrubriken
$db->query("SELECT eid FROM t_belegung WHERE rid='".$this->rid."';");
}
} else { # alle Rubriken
$db->query("SELECT DISTINCT eid FROM t_belegung;");
}
while (list($x1) = $db->data()) { $eid[] = $x1; }
# Hole Firmennummern zu den Eintraegen
if (count($eid) > 0) {
for ($i=0;$i<count($eid); $i++) {
$db->query("SELECT fid FROM t_eintrag WHERE eid='".$eid[$i]."';");
while (list($x1) = $db->data()) { $this->arFid[] = $x1; }
} }
/**
** Filterung der bisherigen Ergebnismenge auf Standort-Kriterium
**/
if ($this->onr == -1) { # ALLE Firmen, unabhaengig vom Standort
if (count($this->arFid) > 0) {
for ($i=0;$i<count($this->arFid); $i++) {
$db->query("SELECT fname, plz FROM t_firma WHERE fid='".$this->arFid[$i]."';");
while (list($x1, $x2) = $db->data()) { $this->arErg[] = $x1; $this->arPlz[] = $x2; }
} }
} else if ($this->onr == -2) { # nur Firmen aus Oesterreich
if (count($this->arFid) > 0) {
$arFid = array(); $arFid = $this->arFid; $this->arFid = array();
$arErg = array(); $arLand = array();
for ($i=0;$i<count($arFid); $i++) { # Hole alle Firmennamen und Laender
$db->query("SELECT fname, land FROM t_firma WHERE fid='".$arFid[$i]."';");
while (list($x1, $x2) = $db->data()) { $arErg[] = $x1; $arLand[] = $x2; }
}
for ($i=0;$i<count($arFid); $i++) { # wenn nicht zum Land gehoert, streichen
if ($arLand[$i] != "Österreich") { $arErg[$i] = ""; $arFid[$i] = ""; }
}
for ($i=0;$i<count($arFid); $i++) { # nur nicht gestrichene uebernehmen
if ($arFid[$i] != "") { $this->arFid[] = $arFid[$i]; $this->arErg[] = $arErg[$i]; }
} }
} else if ($this->onr == -3) { # nur Firmen aus der Schweiz
if (count($this->arFid) > 0) {
$arFid = array(); $arFid = $this->arFid; $this->arFid = array();
$arErg = array(); $arLand = array();
for ($i=0;$i<count($arFid); $i++) { # Hole alle Firmennamen und Laender
$db->query("SELECT fname, land FROM t_firma WHERE fid='".$arFid[$i]."';");
while (list($x1, $x2) = $db->data()) { $arErg[] = $x1; $arLand[] = $x2; }
}
for ($i=0;$i<count($arFid); $i++) { # wenn nicht zum Land gehoert, streichen
if ($arLand[$i] != "Schweiz") { $arErg[$i] = ""; $arFid[$i] = ""; }
}
for ($i=0;$i<count($arFid); $i++) { # nur nicht gestrichene uebernehmen
if ($arFid[$i] != "") { $this->arFid[] = $arFid[$i]; $this->arErg[] = $arErg[$i]; }
} }
} else { # nur Firmen aus dem PLZ-Gebiet
if (count($this->arFid) > 0) {
$arFid = array(); $arFid = $this->arFid; $this->arFid = array();
$arErg = array(); $arPlz = array();
for ($i=0;$i<count($arFid); $i++) { # Hole alle Firmennamen und PLZ's
$db->query("SELECT fname, plz FROM t_firma WHERE fid='".$arFid[$i]."';");
while (list($x1, $x2) = $db->data()) { $arErg[] = $x1; $arPlz[] = $x2; }
}
for ($i=0;$i<count($arFid); $i++) { # wenn nicht zum PLZ-Gebiet gehoert, streichen
if (substr($arPlz[$i], 0, 1) != $this->onr) { $arErg[$i] = ""; $arFid[$i] = ""; $arPlz[$i] = ""; }
}
for ($i=0;$i<count($arFid); $i++) { # nur nicht gestrichene uebernehmen
if ($arFid[$i] != "") { $this->arFid[] = $arFid[$i]; $this->arErg[] = $arErg[$i]; $this->arPlz[] = $arPlz[$i]; }
} } }
/**
** Filterung der bisherigen Ergebnismenge auf enthaltenem Suchstring
** Durchsucht werden die Felder t_firma.fname und t_firma.fzusatz
**/
if ($this->sstr != "") {
$arFid = array(); $arFid = $this->arFid; $this->arFid = array();
$arErg = array(); $arErg = $this->arErg; $this->arErg = array();
$arPlz = array(); $arPlz = $this->arPlz; $this->arPlz = array();
$arFzusatz = array();
for ($i=0; $i<count($arFid); $i++) {
$db->query("SELECT fzusatz FROM t_firma WHERE fid='".$arFid[$i]."';");
while (list($x1) = $db->data()) { $arFzusatz[] = $x1; }
}
for ($i=0; $i<count($arFid); $i++) {
if (ereg($this->sstr, $arErg[$i]) || ereg($this->sstr, $arFzusatz[$i])) {
# gefunden, nixtun
} else { $arErg[$i] = ""; $arFid[$i] = ""; $arPlz[$i] = ""; } # wenn nicht gefunden, streichen
}
for ($i=0;$i<count($arFid); $i++) { # nur nicht gestrichene uebernehmen
if ($arFid[$i] != "") { $this->arFid[] = $arFid[$i]; $this->arErg[] = $arErg[$i]; $this->arPlz[] = $arPlz[$i]; }
} }
/**
** Sortierung der resultierenden Ergebnismenge nach Firma ($sort=1) oder nach PLZ ($sort=2)
**/
# $this->sortErg($sort, $updn);
if ($this->sstr == "") { $this->sstr = "Kein Suchbegriff"; }
return count($this->arFid);
}
};
?>
|
28.09.2006, 21:50:55
|
Senior Member
|
|
Registriert seit: Oct 2004
Ort: Werdenberg / Schweiz
Alter: 36
Beiträge: 1.476
|
|
AW: php-skript wird auf hosteurope nicht gefunden
schau mal mit var_dump nach was $temp in der mysql-db-klasse -> connect()) da fürn wert hat und nimm das @ weg sonst siehst du ja die fehlermeldungen nicht...
__________________
Opendix lehnt jegliche Haftung für evtl. vorhandene Fehler in der Grammatik sowie der Satzstellung ab! Bitte wenden Sie sich an die Tastatur!
Betatester gesucht:
Skiclub Gams / CEVI Grabs
Geändert von Opendix (28.09.2006 um 21:51:19 Uhr)
|
28.09.2006, 22:05:34
|
|
Anfänger
|
|
Registriert seit: Sep 2006
Beiträge: 11
|
|
AW: php-skript wird auf hosteurope nicht gefunden
mit dem @ hast du recht, schön blöd ...
var_dump() ist genial, kannte ich nicht, hab ich jetzt mal ausprobiert.
schade dass temp an dieser stelle bool(true) liefert, die db-verbindung also steht, aber ich werde jetzt mit var_dump mal weitersuchen...
heisser tipp, vielen dank
Geändert von mwX (29.09.2006 um 08:57:28 Uhr)
|
29.09.2006, 10:20:37
|
|
Anfänger
|
|
Registriert seit: Sep 2006
Beiträge: 11
|
|
AW: php-skript wird auf hosteurope nicht gefunden
Hallo opendix,
ich habe das problem gelöst und der auslöser war dein heisser tipp mit dem var_dump(), denn dadurch habe ich eine schnelle gute möglichkeit gefunden, mich zum wirklichen fehler heranzutasten; super und vielen dank
übrigens - um dem sinn des postens gerecht zu werden und damit andere ihn nicht auch machen - der fehler war folgender art:
ich habe ein objekt $O definiert und auf eine eigenschaft $e intern zugegriffen, indem ich schrieb: $this->$e anstatt $this->e
ein wahrer schusseligkeitsfehler, den man allzugern übersieht, aber fatalerweise waren bisher alle server tolerant genug, ausser der zielserver von hosteurope !!!
|
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.
HTML-Code ist aus.
|
|
|
Alle Zeitangaben in WEZ +2. Es ist jetzt 16:39:30 Uhr.
|