Hallo,
nach langer Recherche konnte ich leider keine Lösung für mein Problem finden. Wenn ich Rezepte drucken möchte, kriege ich im Druckfenster folgende Fehlermeldung angezeigt:
Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in C:\XAMPP\xampp\htdocs\Joomla\components\com_garyscookbook\models\print.php on line 49
Das drucken selbst klappt wunderbar, nur sieht das meiner Meinung nach unschön aus. Beim recherchieren hat sich gezeigt, das es noch einige andere Seiten mit Garyscookbook gibt, die diesen Fehler anzeigen.
Wenn man im backend unter Site-> Konfiguration-> Server bei Fehler berichten auf "keine" einstellt, wird der Fehler trotzdem noch angezeigt. Abgesehen davon würde es den Fehler ja auch nur kaschieren...
Die entsprechende php sieht so aus:
// Don't allow direct linking
defined('_JEXEC') or die('Restricted access');
// Don't allow passed settings
if (@$_REQUEST) {
print "<SCRIPT>document.location.href='../../index.php'</SCRIPT>\n";
exit();
}
// option masks
global $hide_js, $catid, $pictpath_absolut;
require_once($GKBabsolut . "/components/com_garyscookbook/helpers/ingredients.php");
$tmplpath = JPATH_COMPONENT . DS . 'views' . DS . 'detail' . DS . 'tmpl';
$dbGKB = &JFactory::getDBO();
$id = JRequest::getCmd('id');
$NewPortion = JRequest::getInt('newportion');
// Database Query
$query1 = "SELECT * FROM #__garyscookbook WHERE id = '$id'";
$dbGKB->setQuery($query1);
$rows = $dbGKB->loadObjectList();
// $result1=mysql_query($query1);
// list($id, $catid, $imgtitle, $imgauthor, $imgtext, $imgdate, $imgcounter, $imgvotes, $imgvotesum, $published, $imgfilename, $imgthumbname, $doc, $price, $country, $portion, $aging, $years, $grapes, $properties, $notes)=mysql_fetch_row($result1);
$rows2 = $rows[0];
$catid = $rows2->catid;
$catid = 10;
// Paging through category
$id_cache = array();
$query1 = "SELECT id, imgfilename FROM #__garyscookbook WHERE catid=$catid ORDER BY id DESC";
$dbGKB->setQuery($query1);
$result1 = $dbGKB->query();
while ($row1 = mysql_fetch_object($result1)) { // !Zeile 49!
$id_cache[] = $row1->id;
$fn_cache[] = $picturepath . $row1->imgfilename;
}
$act_key = array_search($id, $id_cache);
$nid = (isset($id_cache[$act_key + 1])) ? $id_cache[$act_key + 1] : 0;
$pid = (isset($id_cache[$act_key - 1])) ? $id_cache[$act_key - 1] : 0;
unset($id_cache);
echo "<table border='0' cellspacing='0' cellpadding='0' style='width: 100%'>";
echo "<tr align='right'><td align='right' >";
$print_link = JRoute::_('javascript:void window.print()');
echo GKBOutput::printbutton($print_link, 1);
echo "</td></tr></table><div>";
// show picture data
$fimgdate = strftime("%c", $rows2->imgdate);
// $fimgdate =mosformatdate($imgdate);
if (file_exists("$pictpath_absolut/$rows2->imgfilename")) {
$imgsize = filesize("$pictpath_absolut/$rows2->imgfilename");
$fimgsize = number_format($imgsize / 1024, 2, ",", ".");
}
if ($rows2->imgvotes > 0) {
$fimgvotesum = number_format($rows2->imgvotesum / $rows2->imgvotes, 0, ",", ".");
$frating = "($rows2->imgvotes " . JText::_('votes') . ")";
$filename = "point";
} else {
$frating = JText::_('No votes');
}
// $veggiestatus = array ( JText::_('No'), JText::_('Yes') );
$anzahl = count($rows);
// Detailview
$print=True;
require_once($tmplpath . DS . 'detailview.php');
echo "</div>";
?>
Sieht die Datei bei mir vielleicht irgendwie anders aus als bei anderen?