mysql_connect("tkbearcr.ipowermysql.com", "tkbearcr", "mustang13") or die(mysql_error());
mysql_select_db("thetkbearcrew") or die(mysql_error());
//echo "Connected to MySQL
";
?>
include("inc/header.php"); ?>
include("inc/headermenu.php"); ?>
if($id == '' && $rmonth == '' && $ryear == '')
{
// $sql = "SELECT * FROM thetkbearcrew.tbl_news where 1 order by `date` desc limit 25;";
$sql = "SELECT a.ID, a.date, a.title, a.body, a.name, c.id, c.path
FROM thetkbearcrew.tbl_news a
LEFT JOIN thetkbearcrew.tbl_members b ON b.userid = a.name
left join tkbearcrewgallery.`plogger_pictures` c on IFNULL(b.profilepic,2909) = c.id
ORDER BY a.date DESC
limit ".$pageing1.", 10;";
}
elseif($id <> '' )
{
$sql = "SELECT a.ID, a.date, a.title, a.body, a.name, c.id, c.path
FROM thetkbearcrew.tbl_news a
LEFT JOIN thetkbearcrew.tbl_members b ON b.userid = a.name
left join tkbearcrewgallery.`plogger_pictures` c on IFNULL(b.profilepic,2909) = c.id
where a.id = '$id'
ORDER BY a.date DESC";
}
else
{
$sql = "SELECT a.ID, a.date, a.title, a.body, a.name, c.id, c.path
FROM thetkbearcrew.tbl_news a
LEFT JOIN thetkbearcrew.tbl_members b ON b.userid = a.name
left join tkbearcrewgallery.`plogger_pictures` c on IFNULL(b.profilepic,2909) = c.id
where DATE_FORMAT(a.date,'%M') = '".$rmonth."' and DATE_FORMAT(a.date,'%Y') = '".$ryear."'
ORDER BY a.date DESC;";
}
$result = mysql_query($sql)
or die(mysql_error());
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result ))
{
$sql2 = "select count(*) from thetkbearcrew.`tbl_news_comments` a where approved <> '0' and a.parent_id = '".$row[0]."'";
$result2 = mysql_query($sql2)
or die(mysql_error());
// keeps getting the next row until there are no more to get
while($row2 = mysql_fetch_array( $result2 ))
{ $count= $row2[0]; };
$imageurl = explode("/",$row[6]);
$url1=str_replace(" ","_","http://www.tkbearcrew.com/gallery/thumbs/".$row[5]."-".$imageurl[2]);
$url1=str_replace("(","_",$url1);
$url1=str_replace(")","_",$url1);
// drop down values
PRINT "
".$row[2]."
Posted by ".$row[4]." on ".$row[1]." Comments (".$count.")
";
}
print "
";
if ($pageing1 > 9){print "<<-- NEWER POSTS - - - - - - - - - - - - - - - - - - ";}
elseif ($pageing1 > 0){print "<<-- NEWER POSTS - - - - - - - - - - - - - - - - - - ";}
if(mysql_num_rows($result) > 9){print" OLDER POSTS-->> ";}
?>
include("inc/sidebar.php"); ?>