Hi,
I am attempting to show the posts from one web user. However, I am getting this error:
« MODx Parse Error »
MODx encountered the following error while attempting to parse the requested resource:
« Execution of a query to the database failed - 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 ' longtitle, pub_date ORDER BY pub_date DESC LIMIT 10' at line 1 »
SQL: SELECT * FROM `modx`.modx_site_content WHERE pagetitle, longtitle, pub_date ORDER BY pub_date DESC LIMIT 10;
[Copy SQL to ClipBoard]
Parser timing
MySQL: 0.0288 s (15 Requests)
PHP: 0.0485 s
Total: 0.0774 s
I wrote this snippet to try and show one post from the user:
<?php
//Author: Sarah
//Date: 14-03-2007
//This snippet displays the posts made by the user who is currently logged in.
# set page to redirect to if user is not logged in, site_start by default
if(!isset($_SESSION['webInternalKey']) || empty($_SESSION['webInternalKey'])) {
$logout = isset($logout) ? $logout : $modx->config['site_start'];
$modx->sendRedirect($modx->makeUrl($logout));
}
//Get user login name and store it in variable userLogin
$userLogin = $modx->getLoginUserID();
//Find the correct entries in the database that correspond to posts made by this user
//Select the modx table where the posts are stored
$tbl = $modx->getFullTableName('site_content');
$tempUserPosts = $modx->db->select("*", $tbl, "pagetitle, longtitle, pub_date ", "pub_date DESC", "10");
//return $userPosts;
?>
Any help anyone could offer would be greatly appreciated.
Thankyou.
Sarah