hello,
I have problem whit a mysql-query...
this query doesn't work,
$sql = "select messages.*, users.*, threads.*, date_format(messages.ts,'%a %D %M %Y') as msgDate";
$sql .= " from messages, threads";
$sql .= " left join users on";
$sql .= " messages.author = users.id"; #users.id
$sql .= " where messages.Verify = 'Y' AND";
if (!empty($topic)) {
$sql .= " messages.newstipo = $topic AND";
}
$sql .= " threads.parent = 0 AND";
$sql .= " messages.id > 0";
$sql .= " order by messages.ts desc";
the mysql error message:
ERROR 1051: Unknown table 'threads'
but the table threads already exist, i don't understand why this query doesn't work...
before I have this query and this worked.. but i need to add "where parent = 0" from the table threads...
$sql = "select messages.*, users.*, date_format(messages.ts,'%a %D %M %Y') as msgDate";
$sql .= " from messages";
$sql .= " left join users on";
$sql .= " messages.author = users.id"; #users.id
$sql .= " where messages.Verify = 'Y' AND";
if (!empty($topic)) {
$sql .= " messages.newstipo = $topic AND";
}
$sql .= " messages.id > 0";
$sql .= " order by messages.ts desc";
I need help!!!!
Any ideas?
Thanks foba
I have problem whit a mysql-query...
this query doesn't work,
$sql = "select messages.*, users.*, threads.*, date_format(messages.ts,'%a %D %M %Y') as msgDate";
$sql .= " from messages, threads";
$sql .= " left join users on";
$sql .= " messages.author = users.id"; #users.id
$sql .= " where messages.Verify = 'Y' AND";
if (!empty($topic)) {
$sql .= " messages.newstipo = $topic AND";
}
$sql .= " threads.parent = 0 AND";
$sql .= " messages.id > 0";
$sql .= " order by messages.ts desc";
the mysql error message:
ERROR 1051: Unknown table 'threads'
but the table threads already exist, i don't understand why this query doesn't work...
before I have this query and this worked.. but i need to add "where parent = 0" from the table threads...
$sql = "select messages.*, users.*, date_format(messages.ts,'%a %D %M %Y') as msgDate";
$sql .= " from messages";
$sql .= " left join users on";
$sql .= " messages.author = users.id"; #users.id
$sql .= " where messages.Verify = 'Y' AND";
if (!empty($topic)) {
$sql .= " messages.newstipo = $topic AND";
}
$sql .= " messages.id > 0";
$sql .= " order by messages.ts desc";
I need help!!!!
Any ideas?
Thanks foba