realitylive
01.12.2012, 18:17
Anpassen des Datenbankquerys
------------
/* Banner aus der Datenbank holen */
$forcedbanner = $db->query('SELECT tk.kampagnen_id, tk.url_banner, tk.reload, tk.payout, tk.aufendhalt FROM equinox_'.$pageconfig['install_nr'].'_kampagnen AS tk LEFT OUTER JOIN equinox_'.$pageconfig['install_nr'].'_reloads AS tr ON (tr.kampagnen_id = tk.kampagnen_id AND tr.uid = '.$_SESSION['uid'].' AND tr.reload_bis >= '.time().') WHERE tr.kampagnen_id IS NULL AND tk.format = "forcedbanner" AND tk.status = 1 LIMIT '.$userdaten['max_banner']);
------------
um
------------
ORDER BY tk.'.$userdaten['sort_orderby'].' '.$userdaten['sort_order'].'
------------
sodass er in etwa so aussieht:
--- Beispiel ---
$forcedbanner = $db->query('SELECT tk.kampagnen_id, tk.url_banner, tk.reload, tk.payout, tk.aufendhalt FROM equinox_'.$pageconfig['install_nr'].'_kampagnen AS tk LEFT OUTER JOIN equinox_'.$pageconfig['install_nr'].'_reloads AS tr ON (tr.kampagnen_id = tk.kampagnen_id AND tr.uid = '.$_SESSION['uid'].' AND tr.reload_bis >= '.time().') WHERE tr.kampagnen_id IS NULL AND tk.format = "forcedbanner" AND tk.status = 1 ORDER BY tk.'.$userdaten['sort_orderby'].' '.$userdaten['sort_order'].' LIMIT '.$userdaten['max_banner']);
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'RAND() LIMIT 10' at line 1
beim Aufruf erscheint die url dann index.php?content=error/404&sort_orderby=aufenthalt
------------
/* Banner aus der Datenbank holen */
$forcedbanner = $db->query('SELECT tk.kampagnen_id, tk.url_banner, tk.reload, tk.payout, tk.aufendhalt FROM equinox_'.$pageconfig['install_nr'].'_kampagnen AS tk LEFT OUTER JOIN equinox_'.$pageconfig['install_nr'].'_reloads AS tr ON (tr.kampagnen_id = tk.kampagnen_id AND tr.uid = '.$_SESSION['uid'].' AND tr.reload_bis >= '.time().') WHERE tr.kampagnen_id IS NULL AND tk.format = "forcedbanner" AND tk.status = 1 LIMIT '.$userdaten['max_banner']);
------------
um
------------
ORDER BY tk.'.$userdaten['sort_orderby'].' '.$userdaten['sort_order'].'
------------
sodass er in etwa so aussieht:
--- Beispiel ---
$forcedbanner = $db->query('SELECT tk.kampagnen_id, tk.url_banner, tk.reload, tk.payout, tk.aufendhalt FROM equinox_'.$pageconfig['install_nr'].'_kampagnen AS tk LEFT OUTER JOIN equinox_'.$pageconfig['install_nr'].'_reloads AS tr ON (tr.kampagnen_id = tk.kampagnen_id AND tr.uid = '.$_SESSION['uid'].' AND tr.reload_bis >= '.time().') WHERE tr.kampagnen_id IS NULL AND tk.format = "forcedbanner" AND tk.status = 1 ORDER BY tk.'.$userdaten['sort_orderby'].' '.$userdaten['sort_order'].' LIMIT '.$userdaten['max_banner']);
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'RAND() LIMIT 10' at line 1
beim Aufruf erscheint die url dann index.php?content=error/404&sort_orderby=aufenthalt