I'm trying to list attachments in external.php so we can see what's files are available.
PHP Code:
if ($_REQUEST['type'] == 'RSS2') { // check for attachments $attachments = $DB_site->query(" SELECT attachment.filename, attachment.filesize, attachment.visible, attachment.attachmentid, attachment.counter, post.postid FROM " . TABLE_PREFIX . "attachment WHERE post.postid = $postid ORDER BY attachment.dateline "); while ($attachment = $DB_site->fetch_array($attachments)) { $post['attachments']["$attachment[attachmentid]"] = $attachment; } }
That code gives me a database error,
Invalid SQL: SELECT attachment.filename, attachment.filesize, attachment.visible, attachment.attachmentid, attachment.counter, post.postid FROM attachment WHERE post.postid = ORDER BY attachment.dateline mysql error: You have an error in your SQL syntax near 'ORDER BY attachment.dateline ' at line 5mysql error number: 1064
So yea, didn't work...ideas?
Don't you need a join of some sort to get the post.postid from the POST TABLE