Hallo, ich habe auf meinem Webspace ein Newssystem installiert, bzw. ich bin gerade dabei. Ich habe dazu folgendes importiert:
Alles anzeigen
Außerdem habe ich alle MySQL Daten richtig eingetragen. Nun kommt beim Aufruf allerdings die Fehlermeldung:
Notice: Unknown column 'news.hide' in 'where clause' in /home/www/irgendwas/kaihou/lib/db_mysql.php on line 90
Notice: Unknown column 'news.keywords' in 'field list' in /home/www/irgendwas/kaihou/lib/db_mysql.php on line 90
db_mysql.php:
Alles anzeigen
Kann mir bitte jemand helfen?
(Sorry für den langen Post :))
Brainfuck-Quellcode
- -- phpMyAdmin SQL Dump
- -- version 2.9.1.1
- -- http://www.phpmyadmin.net
- --
- -- Host: localhost
- -- Erstellungszeit: 17. Januar 2007 um 23:21
- -- Server Version: 5.0.27
- -- PHP-Version: 5.2.0
- --
- -- Datenbank: `news`
- --
- -- --------------------------------------------------------
- --
- -- Tabellenstruktur für Tabelle `kaihou_comments`
- --
- CREATE TABLE `kaihou_comments` (
- `commentid` int(10) unsigned NOT NULL auto_increment,
- `newsid` int(10) unsigned NOT NULL,
- `name` varchar(100) collate utf8_unicode_ci NOT NULL,
- `email` varchar(100) collate utf8_unicode_ci NOT NULL,
- `content` text collate utf8_unicode_ci NOT NULL,
- `date` int(11) NOT NULL,
- `status` tinyint(4) NOT NULL default '1',
- PRIMARY KEY (`commentid`),
- KEY `newsid` (`newsid`)
- ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ;
- --
- -- Daten für Tabelle `kaihou_comments`
- --
- -- --------------------------------------------------------
- --
- -- Tabellenstruktur für Tabelle `kaihou_ips`
- --
- CREATE TABLE `kaihou_ips` (
- `ip` varchar(15) collate utf8_unicode_ci NOT NULL,
- `commentid` int(10) unsigned NOT NULL,
- `date` int(10) unsigned NOT NULL
- ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
- --
- -- Daten für Tabelle `kaihou_ips`
- --
- -- --------------------------------------------------------
- --
- -- Tabellenstruktur für Tabelle `kaihou_news`
- --
- CREATE TABLE `kaihou_news` (
- `newsid` int(10) unsigned NOT NULL auto_increment,
- `userid` smallint(5) unsigned NOT NULL,
- `title` varchar(255) collate utf8_unicode_ci NOT NULL,
- `content` text collate utf8_unicode_ci NOT NULL,
- `content_more` text collate utf8_unicode_ci NOT NULL,
- `date` int(11) NOT NULL,
- `nl2br` tinyint(1) NOT NULL default '1',
- PRIMARY KEY (`newsid`)
- ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ;
- --
- -- Daten für Tabelle `kaihou_news`
- --
- -- --------------------------------------------------------
- --
- -- Tabellenstruktur für Tabelle `kaihou_users`
- --
- CREATE TABLE `kaihou_users` (
- `userid` smallint(5) unsigned NOT NULL auto_increment,
- `username` varchar(100) collate utf8_unicode_ci NOT NULL,
- `password` varchar(32) collate utf8_unicode_ci NOT NULL,
- PRIMARY KEY (`userid`)
- ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ;
- --
- -- Daten für Tabelle `kaihou_users`
- --
- INSERT INTO `kaihou_users` VALUES (1, 'admin', MD5('test'));
Außerdem habe ich alle MySQL Daten richtig eingetragen. Nun kommt beim Aufruf allerdings die Fehlermeldung:
Notice: Unknown column 'news.hide' in 'where clause' in /home/www/irgendwas/kaihou/lib/db_mysql.php on line 90
Notice: Unknown column 'news.keywords' in 'field list' in /home/www/irgendwas/kaihou/lib/db_mysql.php on line 90
db_mysql.php:
Quellcode
- <?php
- if(!defined("MAIN")) exit('Hacking not allowed');
- class DB_MySQL
- {
- var $LinkId;
- var $LastQueryResource;
- var $LastQueryString;
- var $QueryCount;
- var $Config = array();
- function MySQL($Host, $User, $Password, $Database, $Prefix)
- {
- $this->Config = array("host" => $Host, "user" => $User, "pass" => $Password, "dbase" => $Database, "prefix" => $Prefix);
- $this->LinkId = NULL;
- $this->LastQueryResource = NULL;
- }
- /*public function __destruct()
- {
- $this->Close();
- unset($this->LastQueryResource);
- unset($this->Config);
- }*/
- function SetConfig($Key, $Value)
- {
- $this->Config[$Key] = $Value;
- }
- function GetConfig($Key)
- {
- if(isset($this->Config[$Key]))
- return $this->Config[$Key];
- }
- function Connect($array)
- {
- $this->Config = array("host" => $array[0], "user" => $array[1], "pass" => $array[2], "dbase" => $array[3], "prefix" => $array[4]);
- $this->LinkId = mysql_connect($this->Config['host'], $this->Config['user'], $this->Config['pass']);
- if($this->LinkId == false)
- {
- // put error.
- }
- else
- $this->SelectDatabase($this->Config['dbase']);
- }
- function Close()
- {
- if($this->LinkId != false)
- {
- mysql_close($this->LinkId);
- $this->LinkId == false;
- }
- }
- function IsConnected()
- {
- return ($this->LinkId == false ? false : true);
- }
- function SelectDatabase($Database)
- {
- if(mysql_select_db($Database, $this->LinkId) == false)
- {
- // put error.
- }
- }
- function Query($String, $Unbuffered = false)
- {
- if(!$this->IsConnected()) return false;
- $this->LastQueryString = $String;
- if(defined("DBG_MYSQL")) echo "<pre> $String </pre>";
- $this->QueryCount++;
- if($Unbuffered == false)
- $this->LastQueryResource = mysql_query($String, $this->LinkId);
- else
- $this->LastQueryResource = mysql_unbuffered_query($String, $this->LinkId);
- if($this->LastQueryResource == false)
- {
- trigger_error(mysql_error());
- }
- }
- function GetResource()
- {
- return $this->LastQueryResource;
- }
- function NumRows()
- {
- if($this->GetResource() == false)
- return 0;
- else
- return mysql_num_rows($this->GetResource());
- }
- function AffectedRows()
- {
- if($this->IsConnected() == false)
- return 0;
- else
- return mysql_affected_rows($this->LinkId);
- }
- function FetchArray($Resource = NULL, $Mode = MYSQL_ASSOC)
- {
- if($Resource == NULL)
- $Resource = $this->GetResource();
- if($Resource == false)
- return false;
- $Data = mysql_fetch_array($Resource, $Mode);
- return $Data;
- }
- function Result($Row = 0, $Field = NULL)
- {
- $Resource = $this->GetResource();
- if($Resource == false)
- return false;
- $Data = mysql_result($Resource, $Row, $Field);
- return $Data;
- }
- function InsertId($Table)
- {
- $Table = "`". $this->GetConfig("prefix") . "_" . $Table ."`";
- $this->Query("SELECT LAST_INSERT_ID() FROM ". $Table);
- return $this->Result(0);
- }
- function Escape($String)
- {
- return mysql_real_escape_string($String, $this->LinkId);
- }
- // select
- /*
- andylib_MySQL::Select("field", "table", "WHERE ...");
- andylib_MySQL::Select(array("field1", "field2"), "table", "WHERE ...");
- andylib_MySQL::Select(array("alias" => array("field1", "field2"), "alias2" => array("field3", "field4")), array("table" => "alias", "table2" => array("LEFT JOIN", "alias2", "alias2.id = alias.id")), "WHERE ...");
- */
- function Select($Fields, $Table, $Condition = "")
- {
- // case 1: $Fields is only one field - perform query and return the result directly
- if(is_string($Fields))
- {
- if(strstr($Fields, "COUNT(")) $Field = $Fields;
- else $Field = "`". $Fields ."`";
- $Table = "`". $this->GetConfig("prefix") . "_" . $Table ."`";
- $QueryString = "SELECT {$Field} FROM {$Table} {$Condition}";
- $this->Query($QueryString);
- if($this->NumRows() == 0) return NULL;
- return $this->Result(0);
- }
- // case 2: $Fields is an array - perform query and return mysql_num_rows()
- if(is_array($Fields))
- {
- $Field = "";
- foreach($Fields as $Key => $Value)
- {
- if(is_array($Value))
- foreach($Value as $JoinKey => $JoinField)
- {
- if(!is_numeric($JoinKey))
- {
- if(strstr($JoinKey, "COUNT("))
- $Field .= "COUNT(". $Key .".". (substr($JoinKey, 6)) ." AS `". $JoinField ."`, ";
- elseif(strstr($JoinKey, "SUM("))
- $Field .= "SUM(". $Key .".". (substr($JoinKey, 4)) ." AS `". $JoinField ."`, ";
- else
- $Field .= $Key .".`". $JoinKey ."` AS `". $JoinField ."`, ";
- }
- else
- {
- if(strstr($JoinField, "COUNT("))
- $Field .= "COUNT(". $Key .".". (substr($JoinKey, 6)) .", ";
- elseif(strstr($JoinField, "SUM("))
- $Field .= "SUM(". $Key .".". (substr($JoinKey, 4)) ." AS `". $JoinField ."`, ";
- else
- $Field .= $Key .".`". $JoinField ."`, ";
- }
- }
- else
- $Field .= "`". $Value ."`, ";
- }
- $Tables = "";
- $Joins = "";
- if(is_string($Table))
- $Tables = "`". $this->GetConfig("prefix") . "_" . $Table ."`, ";
- else
- {
- foreach($Table as $Key => $Value)
- {
- if(is_array($Value))
- foreach($Value as $JK)
- $Joins .= $JK[0] ." ". $this->GetConfig("prefix") . "_" . $Key ." AS `". $JK[1] ."` ON ". $JK[2] ." ";
- else
- $Tables .= "`". $this->GetConfig("prefix") . "_" . $Key ."` AS `". $Value ."`, ";
- }
- }
- $Field = substr(trim($Field), 0, -1);
- $Tables = substr(trim($Tables), 0, -1);
- $QueryString = "SELECT {$Field} FROM {$Tables} {$Joins} {$Condition}";
- $this->Query($QueryString);
- return $this->NumRows();
- }
- }
- function Insert($Table, $Fields)
- {
- $Table = "`". $this->GetConfig("prefix") . "_" . $Table ."`";
- $Field = "";
- foreach($Fields as $Key => $Value)
- $Field .= "`". $Key ."` = '". $Value ."', ";
- $Field = substr(trim($Field), 0, -1);
- $QueryString = "INSERT INTO {$Table} SET {$Field}";
- $this->Query($QueryString);
- return $this->AffectedRows();
- }
- function Update($Table, $Fields, $Condition = "")
- {
- $Table = "`". $this->GetConfig("prefix") . "_" . $Table ."`";
- $Field = "";
- foreach($Fields as $Key => $Value)
- {
- if(strlen($Value) != 0)
- $Field .= "`". $Key ."` = ". ($Value{0} != "`" ? "'". $Value ."'" : $Value) .", ";
- else
- $Field .= "`". $Key ."` = '". $Value ."', ";
- }
- $Field = substr(trim($Field), 0, -1);
- $QueryString = "UPDATE {$Table} SET {$Field} {$Condition}";
- $this->Query($QueryString);
- return $this->AffectedRows();
- }
- function Delete($Table, $Condition = "")
- {
- $Table = "`". $this->GetConfig("prefix") . "_" . $Table ."`";
- $QueryString = "DELETE FROM {$Table} {$Condition}";
- $this->Query($QueryString);
- return $this->AffectedRows();
- }
- }
- ?>
Kann mir bitte jemand helfen?
(Sorry für den langen Post :))