fehler bei einer datenbank abfrage für suche

Hier könnt Ihr fragen zu Problemen mit Sql (MySql) in Verbindung mit PHP stellen. Es können fragen zu SQL Anweisungen und/oder PHP Mysql Funktionen gestellt werden.

fehler bei einer datenbank abfrage für suche

Beitragvon mrburns am Di, 18:56:36 9.02.10

ich hab für die suche bei phpfusion für eine infusion eine datenbank abfrage geschrieben bzw es versucht bin noch neu auf dem gebiet also hatte ich mir eine andere such datei genommen und versucht für die infusion umzuschreiben aber es hat leider nicht funktioniert
der code ist dieser
  1. <?php
  2. /*-------------------------------------------------------+
  3. | PHP-Fusion Content Management System
  4. | Copyright (C) 2002 - 2008 Nick Jones
  5. | http://www.php-fusion.co.uk/
  6. +--------------------------------------------------------+
  7. | Filename: search_marketplace_include.php
  8. | Author: Robert Gaudyn (Wooya)
  9. +--------------------------------------------------------+
  10. | This program is released as free software under the
  11. | Affero GPL license. You can redistribute it and/or
  12. | modify it under the terms of this license which you
  13. | can read by viewing the included agpl.txt or online
  14. | at www.gnu.org/licenses/agpl.html. Removal of this
  15. | copyright header is strictly prohibited without
  16. | written permission from the original author(s).
  17. +--------------------------------------------------------*/
  18. if (!defined("IN_FUSION")) { die("Access Denied"); }
  19.  
  20. include LOCALE.LOCALESET."search/mplace.php";
  21.  
  22. if ($_GET['stype'] == "marketplace" || $_GET['stype'] == "all") {
  23.     if ($_GET['sort'] == "datestamp") {
  24.         $sortby = "mplace_datestamp";
  25.     } else if ($_GET['sort'] == "subject") {
  26.         $sortby = "mplace_article";
  27.     } else {
  28.         $sortby = "mplace_datestamp";
  29.     }
  30.     $ssubject = search_querylike("mplace_article");
  31.     $smessage = search_querylike("mplace_message");
  32.     if ($_GET['fields'] == 0) {
  33.         $fieldsvar = search_fieldsvar($ssubject);
  34.     } else if ($_GET['fields'] == 1) {
  35.         $fieldsvar = search_fieldsvar($smessage);
  36.     } else if ($_GET['fields'] == 2) {
  37.         $fieldsvar = search_fieldsvar($ssubject, $smessage);
  38.     } else {
  39.         $fieldsvar = "";
  40.     }
  41.     if ($fieldsvar) {
  42.         $result = dbquery(
  43.             "SELECT td.*,tdc.* FROM ".DB_MARKETPLACE." td
  44.             INNER JOIN ".DB_MARKETPLACE." tdc ON td.marketplace=tdc.mplace_message
  45.             ".($_GET['datelimit'] != 0 ? " AND mplace_datestamp>=".(time() - $_GET['datelimit']):"")
  46.         );
  47.         $rows = dbrows($result);
  48.     } else {
  49.         $rows = 0;
  50.     }
  51.     if ($rows != 0) {
  52.         $items_count .= THEME_BULLET."&nbsp;<a href='".FUSION_SELF."?stype=marketplace&amp;stext=".$_GET['stext']."&amp;".$composevars."'>".$rows." ".($rows == 1 ? $locale['d401'] : $locale['d402'])." ".$locale['522']."</a><br />\n";
  53.         $result = dbquery(
  54.             "SELECT td.*,tdc.* FROM ".DB_MARKETPLACE." td
  55.             INNER JOIN ".DB_MARKETPLACE." tdc ON td.marketplace=tdc.mplace_massage
  56.             ".($_GET['datelimit'] != 0 ? " AND mplace_datestamp>=".(time() - $_GET['datelimit']):"")."
  57.             ORDER BY ".$sortby." ".($_GET['order'] == 1 ? "ASC" : "DESC").($_GET['stype'] != "all" ? " LIMIT ".$_GET['rowstart'].",10" : "")
  58.         );
  59.         while ($data = dbarray($result)) {
  60.             $search_result = "";
  61.             if ($data['mplace_datestamp']+604800 > time()+($settings['timeoffset']*3600)) {
  62.                 $new = " <span class='small'>".$locale['d403']."</span>";
  63.             } else {
  64.                 $new = "";
  65.             }
  66.             $text_all = $data['mplace_message'];
  67.             $text_all = search_striphtmlbbcodes($text_all);
  68.             $text_frag = search_textfrag($text_all);
  69.             $subj_c = search_stringscount($data['mplace_article']);
  70.             $text_c = search_stringscount($data['mplace_message']);
  71.             $text_frag = highlight_words($swords, $text_frag);
  72.             $search_result .= "<a href='marketplace.php?mplace_id=".$data['marketplace']."&amp;mplace_id=".$data['mpalce_id']."' target='_blank'>".highlight_words($swords, $data['mplace_article'])."</a> - ".$data['download_price']." $new"."<br /><br />\n";
  73.             if ($text_frag != "") $search_result .= "<div class='quote' style='width:auto;height:auto;overflow:auto'>".$text_frag."</div><br />";
  74.             $search_result .= "<span class='small'><span class='alt'>".$locale['d404']."</span> ".$data['mplace_price']." |\n";
  75.             $search_result .= "<span class='alt'>".$locale['d405']."</span> ".$data['mplace_price']." |\n";
  76.             $search_result .= "<span class='alt'>".$locale['d406']."</span> ".$data['mplace_price']."<br />\n";
  77.             $search_result .= "<span class='alt'>".$locale['d407']."</span> ".showdate("%d.%m.%y", $data['mplace_datestamp'])." |\n";
  78.             $search_result .= "<span class='alt'>".$locale['d408']."</span> ".$data['mplace_sold']."</span><br /><br />\n";
  79.             search_globalarray($search_result);
  80.         }
  81.     } else {
  82.         $items_count .= THEME_BULLET."&nbsp;0 ".$locale['d402']." ".$locale['522']."<br />\n";
  83.     }
  84.     $navigation_result = search_navigation($rows);
  85. }
  86. ?>


und der
  1. <?php
  2. /*-------------------------------------------------------+
  3. | PHP-Fusion Content Management System
  4. | Copyright (C) 2002 - 2008 Nick Jones
  5. | http://www.php-fusion.co.uk/
  6. +--------------------------------------------------------+
  7. | Filename: search_marketplace_include_button.php
  8. | Author: Robert Gaudyn (Wooya)
  9. +--------------------------------------------------------+
  10. | This program is released as free software under the
  11. | Affero GPL license. You can redistribute it and/or
  12. | modify it under the terms of this license which you
  13. | can read by viewing the included agpl.txt or online
  14. | at www.gnu.org/licenses/agpl.html. Removal of this
  15. | copyright header is strictly prohibited without
  16. | written permission from the original author(s).
  17. +--------------------------------------------------------*/
  18. if (!defined("IN_FUSION")) { die("Access Denied"); }
  19.  
  20. include LOCALE.LOCALESET."search/mplace.php";
  21.  
  22. $form_elements['marketplace']['enabled'] = array("datelimit", "fields1", "fields2", "fields3", "sort", "order1", "order2", "chars");
  23. $form_elements['marketplace']['disabled'] = array();
  24. $form_elements['marketplace']['display'] = array();
  25. $form_elements['marketplace']['nodisplay'] = array();
  26.  
  27. $radio_button['marketplace'] = "<label><input type='radio' name='stype' value='marketplace'".($_GET['stype'] == "marketplace" ? " checked='checked'" : "")." onclick=\"display(this.value)\" /> ".$locale['d400']."</label>";
  28. ?>


wenn ich nun einen such begriff eingebe bekomm ich die fehler meldung
Unknown column 'td.marketplace' in 'on clause'
so nun hab ich schon gelesen das die datenbank angabe nicht stimmt aber ich weiss auch absolut nicht wie das ganze aussehen muss
hoffe es kann mir jemand helfen
gruss christian
mrburns
Newbi
 
Beiträge: 1
Registriert: Di, 18:47:46 9.02.10

Re: fehler bei einer datenbank abfrage für suche

Beitragvon Marcel am Mi, 20:13:54 10.02.10

  1. dbquery(
  2.             "SELECT td.*,tdc.* FROM ".DB_MARKETPLACE." td
  3.             INNER JOIN ".DB_MARKETPLACE." tdc ON td.marketplace=tdc.mplace_message
  4.             ".($_GET['datelimit'] != 0 ? " AND mplace_datestamp>=".(time() - $_GET['datelimit']):"")


Die Fehlermeldung sagt eigentlich, das es die Spalte marketplace in der DB Tabelle DB_MARKETPLACE nicht gibt. Musste mal überprüfen ob du eigentlich auf eine andere Spalte prüfen wolltest.
MfG
Marcel
Marcel
Member
 
Beiträge: 542
Registriert: Di, 16:13:41 3.01.06

Zurück zu PHP mit Sql



cron