Du befindest Dich im Archiv vom ABAKUS Online Marketing Forum. Hier kannst Du Dich für das Forum mit den aktuellen Beiträgen registrieren.

SQL Syntax Problem

Ajax, Hijax, Microformats, RDF, Markup, HTML, PHP, CSS, MySQL, htaccess, robots.txt, CGI, Java, Javascript usw.
Neues Thema Antworten
mark007q
PostRank 5
PostRank 5
Beiträge: 225
Registriert: 11.09.2005, 15:43
Wohnort: Bochum

Beitrag von mark007q » 11.08.2006, 12:15

Ich komme bei einer Sache irgendwie nicht richtig weiter und zwar:

Bei folgendem Code:

Code: Alles auswählen

# Heute
#

# Themen
$time_today= mktime(0,0,0,date("m"),date("d"),date("Y"));
$where="post_date > $time_today";

$anz= $_db->fetch_array( $_db->query("SELECT COUNT(id) AS num
                                       FROM $TB_TOPIC WHERE $where"));

$topics_today= $anz["num"];

# Beiträge
$anz= $_db->fetch_array( $_db->query("SELECT COUNT(id) AS num
                                       FROM $TB_POST WHERE $where"));

$posts_today= $anz["num"];
#
#Gestern
#

# Themen
$yesterday=date("d")-1;
$time_yesterday= mktime(0,0,0,date("m"),$yesterday,date("Y"));
$where="post_date between $time_yesterday and $time_today";

$anz= $_db->fetch_array( $_db->query("SELECT COUNT(id) AS num
                                       FROM $TB_TOPIC WHERE $where"));

$topics_yesterday= $anz["num"];

# Beiträge
$anz= $_db->fetch_array( $_db->query("SELECT COUNT(id) AS num
                                       FROM $TB_POST WHERE $where"));

$posts_yesterday= $anz["num"];
erhalte ich diese Fehlermeldung:

SQL Error: 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 'WHERE post_date > 1155247200' at line 2
SELECT COUNT(id) AS num
FROM WHERE post_date > 1155247200
SQL Error: 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 'WHERE post_date > 1155247200' at line 2
SELECT COUNT(id) AS num
FROM WHERE post_date > 1155247200
SQL Error: 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 'WHERE post_date between 1155160800 and 1155247200' at line 2
SELECT COUNT(id) AS num
FROM WHERE post_date between 1155160800 and 1155247200
SQL Error: 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 'WHERE post_date between 1155160800 and 1155247200' at line 2
SELECT COUNT(id) AS num
FROM WHERE post_date between 1155160800 and 1155247200

Hat jemand eine Idee wo der Fehler in der Syntax liegen könnte?