Hi
ich habe schon gesucht und leider nichts gefunden was jetzt genau zu meinem Problem passt.
Folgendes:
Ich habe eine Extension unter Typo 3.5 geschrieben, diese funktioniert dort auch einwandfrei.
Jetzt habe ich auf einem anderen Rechner Typo 3.6 laufen und wollte dort meine Extension installieren, aber nun kriege ich eine Fehlermeldung.
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:Apachehtdocsquickstart ypo3confext
m_eventspi1class.tx_rmevents_pi1.php on line 76
Das hier ist der Fehlerhafte teil:
$query = "SELECT * FROM tx_rmevents_content WHERE pid IN (".$pid.") ORDER BY sorting";
$res = mysql(TYPO3_db,$query);
$out = array();
while($row = mysql_fetch_assoc($res)) {
$out[]=$row;
}
return $out;
Da ich noch relativ unwissend im Bezug auf Typo bin habe ich diese Extension nach dem Dokument "Creating a basic extension" erstellt.
Der oben stehende Code wurde daher von mir aus dieser Anleitung übernommen.
Hat vielleicht jemand eine Idee wie ich den Fehler jetzt wieder beseitigen kann?
$res = mysql(TYPO3_db,$query);
echo mysql_error();
mach ma ne error ausgabe, dann weiste bescheid
Danke für den schnellen Tip!
Unknown column 'sorting' in 'order clause'
Habe jetzt den "ORDER BY sorting"-Teil rausgenommen und jetzt funktioniert es wieder...
Frage mich nur grad ob das weitere Auswirkungen auf die Ausgabe hat.
Edit:
Zu früh gefreut...
Jetzt ist zwar der Fehler weg, aber eine Ausgabe kriege ich dennoch nicht!
Mit Typo 3.5 hatte ich eine Ausgabe... hat vielleicht noch jemand ein Tutorial für Typo 3.6 Extension building?
Es scheint sich ja schon einiges geändert zu haben :-/
Hier mal der ganze Code:
require_once(PATH_tslib."class.tslib_pibase.php");
class tx_rmevents_pi1 extends tslib_pibase {
var $prefixId = "tx_rmevents_pi1"; // Same as class name
var $scriptRelPath = "pi1/class.tx_rmevents_pi1.php"; // Path to this script relative to the extension dir.
var $extKey = "rm_events"; // The extension key.
/**
* Function main()
*/
function main($content,$conf) {
$this->conf=$conf;
$this->pi_setPiVarDefaults();
$this->pi_loadLL();
$content="";
$GLOBALS["TSFE"]->set_no_cache();
if(t3lib_div::GPvar("event")) {
$row = $this->getSingle(t3lib_div::GPvar("event"));
$content.=$row("event_name");
$content.="<a href=index.php?id=".$GLOBALS["TSFE"]->id.">Back</a>";
}
else {
$rows=$this->getItems();
while(list($c,$row)=each($rows)) {
$content.=$row("event_name");
$content.="<a href=index.php?id=".$GLOBALS["TSFE"]->id."&event=".$row["uid"].">Details</a>";
}
}
#t3lib_div::debug($conf):
#t3lib_div::debug($this->getItems());
return $content;
}
/**
* Function getItems()
**/
function getItems() {
//pid_list is the pid/list of pids from where to fetch the guest items.
$config["pid_list"] = trim($this->cObj->stdWrap($this->conf["pid_list"],$this->conf["pid_list."]));
$config["pid_list"] = $config["pid_list"] ? implode(t3lib_div::intExplode(",",$config["pid_list"]),",") : $GLOBALS["TSFE"]->id;
list($pid) = explode(",",$config["pid_list"]);
$query = "SELECT * FROM tx_rmevents_content WHERE pid IN (".$pid.")";// ORDER BY sorting";
$res = mysql(TYPO3_db,$query);
echo mysql_error();
$out = array();
while($row = mysql_fetch_assoc($res)) {
$out[]=$row;
}
return $out;
}
/**
* Function getSingle()
**/
function getSingle($uid) {
//pid_list is the pid/list of the pids from where to fetch the guest items.
$config["pid_list"] = trim($this->cObj->stdWrap($this->conf["pid_list"],$this->conf["pid_list."]));
$config["pid_list"] = $config["pid_list"] ? implode(t3lib_div::intExplode(",",$config["pid_list"]),",") : $GLOBALS["TSFE"]->id;
list($pid) = explode(",",$config["pid_list"]);
$query = "SELECT * FROM tx_rmevents_content WHERE pid IN (".$pid.") AND uid = ".$uid."";// ORDER BY sorting";
$res = mysql(TYPO3_db,$query);
$row = array();
$row = mysql_fetch_assoc($res);
return $row;
}
}
if (defined("TYPO3_MODE") && $TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/rm_events/pi1/class.tx_rmevents_pi1.php"]) {
include_once($TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/rm_events/pi1/class.tx_rmevents_pi1.php"]);
}