First, I'll start with the error message:
Parse error: syntax error, unexpected T_CONCAT_EQUAL in /hermes/bosweb/web161/b1610/ipg.teklyscom/news/resources/func/blog.php on line 58
If you want to verify, you can find it at http://www.teklys.com/news/index.php
Here are lines 41 to 66:
function get_posts($id = null, $cat_id = null) {
$posts = array();
$query = "SELECT 'posts'.'id' AS 'post_id', 'categories'.'id' AS 'category_id',
'title', 'contents', 'date_posted', 'categories'.'name'
FROM 'posts'
INNER JOIN 'categories' ON 'categories'.'id' = 'posts'.'cat_id'";
if ( isset($id)) {
$id = (int)$id;
$query .= " WHERE 'posts'.'id' = {$id}";
}
if ( isset($cat_id)) {
$cat_id = (int) $cat_id;
$query .= " WHERE 'cat_id' = {$cat_id}";
}
query .= " ORDER BY 'posts'.'id' DESC"; #THIS IS LINE 58
$query = mysql_query($query);
while ( $row = mysql_fetch_assoc($query)) {
$posts[] = $row;
}
return $posts;
}
What am I doing wrong that is causing the error?
Parse error: syntax error, unexpected T_CONCAT_EQUAL in /hermes/bosweb/web161/b1610/ipg.teklyscom/news/resources/func/blog.php on line 58
If you want to verify, you can find it at http://www.teklys.com/news/index.php
Here are lines 41 to 66:
function get_posts($id = null, $cat_id = null) {
$posts = array();
$query = "SELECT 'posts'.'id' AS 'post_id', 'categories'.'id' AS 'category_id',
'title', 'contents', 'date_posted', 'categories'.'name'
FROM 'posts'
INNER JOIN 'categories' ON 'categories'.'id' = 'posts'.'cat_id'";
if ( isset($id)) {
$id = (int)$id;
$query .= " WHERE 'posts'.'id' = {$id}";
}
if ( isset($cat_id)) {
$cat_id = (int) $cat_id;
$query .= " WHERE 'cat_id' = {$cat_id}";
}
query .= " ORDER BY 'posts'.'id' DESC"; #THIS IS LINE 58
$query = mysql_query($query);
while ( $row = mysql_fetch_assoc($query)) {
$posts[] = $row;
}
return $posts;
}
What am I doing wrong that is causing the error?